home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1989-01-07 | 1.5 KB | 33 lines |
- 100 CLS: REM clear the screen and home cursor
- 110 INPUT "supply voltage (4.5 to 16)? ";VCC: REM prompt user for data
- 120 INPUT "capacitor in farads? ";C: REM prompt user for data
- 130 INPUT "frequency in hz.? ";F: REM prompt use for data
- 140 IF F > 500000 THEN PRINT "frequency is out of reliable range": GOTO 130
- 150 IF F < 0.000555999 THEN PRINT "frequency is out of reliable range": GOTO 130
- 160 INPUT "duty cycle in % (1 to 99)? ";DC: REM prompt for data
- 170 IF DC < 1 THEN GOTO 160
- 180 IF DC > 99 THEN GOTO 160
- 190 RM = (0.3333 * VCC)/2.49E-07: REM max resistor value
- 200 DC = DC / 100: REM compute time high
- 210 TH = DC / F: REM compute time high
- 220 TL = 1 / F - TH: REM compute time low
- 230 IF DC < 0.5 THEN GOTO 320: REM diode will be required
- 240 RB = TL / (0.67 * C): REM COMPUTE RESISTOR B
- 250 RA = TH / (0.67 * C) - RB: REM compute resistor a
- 260 IF RB < 3000 THEN PRINT "your capacitor should be smaller": GOTO 400
- 270 IF RA < 5000 THEN GOTO 320: REM try again using diode
- 280 IF RA > RM OR RB > RM THEN PRINT "you capacitor should be larger":GOTO 400
- 290 PRINT "the value of ra = ";RA
- 300 PRINT "the value of rb = ";RB
- 310 END
- 320 RA = TH / (0.67 * C): REM compute resistor a
- 330 IF RA < 5000 THEN PRINT "your capacitor should be smaller":GOTO 400
- 340 RB = TL / (0.67 * C): REM compute resistor b
- 350 IF RB < 3000 THEN PRINT "your capacitor should be smaller":GOTO 400
- 360 IF RA > RM OR RB > RM THEN PRINT "your capacitor should be larger":GOTO 400
- 370 PRINT "the value of ra = ";RA
- 380 PRINT "the value of rb = ";RB
- 390 PRINT "the diode will be required"
- 400 PRINT :PRINT " HIT SPACE BAR TO RETURN TO MENU"
- 410 K$ = INKEY$: IF K$=" " THEN RUN "MENU2" ELSE 410
-