ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

74 lines
2.8 KiB

  1. 10 'ATTENUATOR DESIGN PROGRAM
  2. 12 'Written in MICROSOOFT BASIC 7/31/82 by
  3. 14 ' Trevor Marshall, SYSOP, Thousand Oaks Technical RBBS
  4. 16 '
  5. 20 'This program designs T, PI, or minimum loss attenuators
  6. 30 ' T PI Min Loss Z1>Z2 Z1<Z2
  7. 40 ' ---R1----R2-- -----R3----- ----R1---- ----R1----
  8. 50 ' | | | | |
  9. 60 ' R3 R1 R2 R2 R2
  10. 70 ' | | | | |
  11. 80 ' ------------- ------------ --------- ----------
  12. 90 '
  13. 100 INPUT "What attenuator do you want, TEE, PI or MINIMUM LOSS..";A$
  14. 105 IF A$ = "QUIT" THEN GOTO 7999
  15. 110 PRINT:INPUT "What is the input impedance...";A
  16. 120 PRINT:INPUT "What is the output impedance..";B
  17. 130 IF LEFT$(A$,1)="M" OR LEFT$(A$,1)="m" THEN GOTO 3000
  18. 140 PRINT:INPUT "What is the required loss (in dB)...";X
  19. 150 GOSUB 6000
  20. 160 IF R2>X THEN GOTO 2600 'Loss too low
  21. 170 PRINT "Asymmetrical"
  22. 172 IF LEFT$(A$,1)="P" OR LEFT$(A$,1)="p" THEN GOTO 1000
  23. 180 PRINT "Tee Section" : PRINT
  24. 190 PRINT "--R1-----R2--"
  25. 200 PRINT " |"
  26. 210 PRINT " R3"
  27. 220 PRINT " |"
  28. 230 PRINT "-------------" : PRINT : GOTO 2000
  29. 1000 PRINT " PI Section" :PRINT
  30. 1010 PRINT "------R3------"
  31. 1020 PRINT " | |"
  32. 1030 PRINT " R1 R2"
  33. 1040 PRINT " | |"
  34. 1050 PRINT "--------------"
  35. 2000 PRINT "Source Impedance=";A;: PRINT ",Terminating Impedance=";B;
  36. 2010 PRINT "Loss (dB)=";X
  37. 2020 Y=10!^(X/10!) : IF LEFT$(A$,1)="P" OR LEFT$(A$,1)="p" THEN GOTO 2500
  38. 2040 R3=SQR(Y*A*B)*2!/(Y-1)
  39. 2060 PRINT "R1=";A*((Y+1!)/(Y-1!))-R3;
  40. 2080 PRINT ",R2=";B*((Y+1!)/(Y-1!))-R3;
  41. 2090 PRINT ",R3=";R3 : PRINT : PRINT : GOTO 10
  42. 2500 R3=((Y-1!)/2!)*SQR(A*B/Y)
  43. 2510 PRINT "R1=";1!/(((Y+1!)/(A*(Y-1!)))-1!/R3);
  44. 2520 PRINT ",R2=";1!/(((Y+1!)/(B*(Y-1!)))-1!/R3);
  45. 2530 PRINT ",R3=";R3 : PRINT : PRINT : GOTO 10
  46. 2600 PRINT "Specified loss is too low..adjusting to...."
  47. 3000 PRINT "MINIMUM LOSS PAD DESIGN" : PRINT
  48. 3010 IF A>B THEN GOTO 5000
  49. 3020 PRINT "Pad for Z2 > Z1" : PRINT
  50. 3030 PRINT "--------R1----"
  51. 3040 PRINT " |"
  52. 3050 PRINT " R2"
  53. 3060 PRINT " |"
  54. 3070 PRINT "--------------" : PRINT
  55. 4000 PRINT "Source Impedance=";A;: PRINT ",Terminating Impedance=";B
  56. 4010 GOSUB 6000
  57. 4020 PRINT "R1=,";R0*SQR(1!-R1/R0);: PRINT ",R2=";R1/(SQR(1!-R1/R0))
  58. 4030 PRINT "Loss (dB)=";R2 : PRINT : PRINT : GOTO 10
  59. 5000 PRINT "Pad for Z1 > Z2" : PRINT
  60. 5010 PRINT "----R1--------"
  61. 5020 PRINT " |"
  62. 5030 PRINT " R2"
  63. 5040 PRINT " |"
  64. 5050 PRINT "--------------"
  65. 5060 GOTO 4000
  66. 6000 R0=A : R1=B : IF B>A THEN R0=B : IF B>A THEN R1=A
  67. 6010 R2=10!*LOG((SQR(R0/R1)+SQR(R0/R1-1!))^2!)/2.30259 : RETURN
  68. 7000 REM ----------------------------------------------------------------
  69. 7010 REM Updated for bwBASIC 3.0 by Howard Wulf, AF5NE, May 7th 2015:
  70. 7020 REM a) Added line 105 for automated testing
  71. 7030 REM
  72. 7999 END