home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HAM Radio 1
/
HamRadio.cdr
/
tech
/
inductor
/
inductor.bas
Wrap
BASIC Source File
|
1988-10-13
|
3KB
|
53 lines
100 'Program to calculate the number of turns for an inductor.
110 CLS : pi = 3.1415926545#
120 k = 1473061.855# 'mhos per square inch of area of copper
130 PRINT " *****************************************"
140 PRINT " * Inductor Design Calculator *"
150 PRINT " * by David E. Powell, KA4KNG *"
160 PRINT " *****************************************": PRINT : PRINT
210 INPUT "Desired inductance in microhenries"; L
220 INPUT "Guage or diameter of wire in inches"; diameter
230 INPUT "Diameter of coil form in inches"; form
240 IF diameter >= 1 THEN diameter = .46 / 1.1229283027# ^ (diameter + 3)
250 PRINT : PRINT "calculating";
260 layers = 1 'Single layer starting out
500 a = diameter * layers + form'Average coil diameter to center of thickness
510 GOSUB 2000 'Calculate the number of turns
520 IF prob = 1 THEN layers = layers + 1: IF layers < 100 THEN GOTO 500
530 IF b > 1 THEN layers = layers + 1: GOTO 500
540 IF n > 9999 THEN PRINT "ERROR - turns count larger than 10000": SYSTEM
550 n = CINT(n): b = n * diameter / layers: ltry = (.2 * a ^ 2 * n ^ 2) / (3 * a + 9 * b + 10 * c)
560 w.length = n * a * pi
570 'calculate the resistance of coil
580 w.area = (diameter / 2) ^ 2 * pi
590 r = 1 / (w.area * k) * w.length
800 'show the results
810 PRINT : PRINT
815 PRINT "Overall coil diameter...... "; diameter * layers * 2 + form; "inches"
820 PRINT "Average coil diameter...... "; a; "inches"
830 PRINT "Depth of coil.............. "; layers * diameter; "inches"
840 PRINT "Length of coil............. "; b; "inches"
850 PRINT "Length of wire (approx).... "; INT(w.length / 12); "feet,";
855 PRINT INT((w.length - INT(w.length)) * 12); "inches"
860 PRINT "Number of layers........... "; layers
870 PRINT "Number of turns............ "; n
880 PRINT "Number of turns per layer.. "; n / layers
890 PRINT "Actual inductance.......... "; ltry; "microhenries"
900 PRINT "Coil DC resistance......... "; r; "ohms"
1000 SYSTEM 'Exit the program and BASIC
2000 'subroutine to calculate the number of turns
2010 muin.n = 1: max.n = 10000: c = layers * diameter: prob = 0
2060 n = (max.n - min.n) / 2 + min.n
2070 b = n * diameter / layers
2080 ltry = (.2 * a ^ 2 * n ^ 2) / (3 * a + 9 * b + 10 * c)
2090 IF CINT(max.n) = CINT(min.n) THEN GOTO 3000
2100 IF min.n >= 9999 THEN prob = 1: GOTO 3000
2110 IF ltry < L THEN min.n = n: GOTO 2060
2120 IF ltry > L THEN max.n = n: GOTO 2060
3000 RETURN