home *** CD-ROM | disk | FTP | other *** search
/ HAM Radio 1 / HamRadio.cdr / tech / jbl / rcfilter.bas < prev    next >
BASIC Source File  |  1985-08-05  |  2KB  |  54 lines

  1. 1 CLS : COLOR 15
  2. 2 'RCFILTER.BAS program written by Drew Daniels, Applications Engineer,
  3. 3 'JBL Professional.  Updated 7-85 to solve for R or C and entry error trap.
  4. 4 PRINT"Copyright C 1985 by Drew Daniels":PRINT
  5. 5 PRINT"This program calculates RC filter variables based on the equation
  6. 6 PRINT"f = 1/2*PI*R*C, and allows you to enter two available variables and
  7. 7 PRINT"solve for the missing R, C, or the -3 dB frequency." : PRINT
  8. 8 PRINT"Do you want to know R (press R), C (press C) or frequency (press F)"
  9. 9 INPUT A$
  10. 10 IF A$="F" OR A$="f" THEN GOTO 13 ELSE GOTO 11
  11. 11 IF A$="C" OR A$="c" THEN GOTO 36 ELSE GOTO 12
  12. 12 IF A$="R" OR A$="r" THEN GOTO 26 ELSE GOTO 1
  13. 13 'CALCULATES FREQUENCY AND PERIOD FROM R AND C
  14. 14 CLS
  15. 15 INPUT"Enter capacitor value in microfarads   ",C
  16. 16 C1=C/1000000! : PRINT
  17. 17 INPUT"Enter resistor value in ohms   ",R : PRINT
  18. 18 F=1/(6.2832*R*C1) : P=1/F
  19. 19 P1=P*1000000!
  20. 20 PRINT"     -3 dB frequency          cycle period"
  21. 21 PRINT"        in hertz             in microseconds"
  22. 22 PRINT"    -----------------        -----------------"
  23. 23 PRINT USING"     ###,###,###.#           ###,###,###,###";F,P1
  24. 24 PRINT
  25. 25 GOTO 8
  26. 26 'CALCULATES R FROM FREQUENCY AND C
  27. 27 CLS
  28. 28 PRINT : PRINT"To solve for R:"
  29. 29 INPUT"Enter frequency in hertz  ",F : PRINT
  30. 30 INPUT"Enter capacitor value in microfarads  ",C : PRINT
  31. 31 C1=C/1000000!
  32. 32 R=1/(6.2832*F*C1)
  33. 33 PRINT USING"The resistance is ###,###,###.# ohms";R
  34. 34 PRINT
  35. 35 GOTO 8
  36. 36 'CALCULATES C FROM FREQUENCY AND R
  37. 37 CLS
  38. 38 PRINT : PRINT"To solve for C:"
  39. 39 INPUT"Enter frequency in hertz  ",F : PRINT
  40. 40 INPUT"Enter resistance in ohms  ",R : PRINT
  41. 41 C=1/(6.2832*F*R)
  42. 42 C1=C*1000000!
  43. 43 C2=C1*1000
  44. 44 C3=C1*1000000!
  45. 45 PRINT"The capacitor value is:"
  46. 46 PRINT" uF                nF                  pF"
  47. 47 PRINT"-------            -------             -------"
  48. 48 IF C2>10000 THEN C2=0
  49. 49 IF C3>10000 THEN C3=0
  50. 50 PRINT USING"#,###.#            #,###.#             #,###.#";C1,C2,C3
  51. 51 PRINT
  52. 52 GOTO 8
  53. 53 END
  54.