Created
March 19, 2011 04:00
-
-
Save laclefyoshi/877207 to your computer and use it in GitHub Desktop.
bc script for calculating 555 timer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define af(r1, r2, c) { | |
auto defscale, t1, t2, total, freq, duty; | |
defscale = scale; | |
scale = 6; | |
t1 = l(2) * (r1 + r2) * c; | |
t2 = l(2) * r2 * c; | |
total = t1 + t2; | |
freq = 1 / total; | |
duty = t1 / total; | |
print "R1: ", r1, ", R2: ", r2, ". C: ", c, "¥n"; | |
print "¥tHIGH:", t1, " + LOW:", t2, " = TOTAL:", total, "(sec)¥n"; | |
print "¥tFreq: ", freq, " Duty: ", duty; | |
scale = defscale; | |
} | |
define ar(f, d, c) { | |
auto defscale, r1, r2; | |
defscale = scale; | |
scale = 6; | |
r1 = (2 * d - 1) / (f * c * l(2)); | |
r2 = (1 - d) / (f * c * l(2)); | |
print "Freq: ", f, ", Duty: ", d, ", C: ", c, "¥n"; | |
print "¥tR1: ", r1, ", R2: ", r2, "¥n¥tTOTAL: ", 1/f; | |
scale = defscale; | |
} | |
define mt(r1, c) { | |
auto defscale; | |
defscale = scale; | |
scale = 6; | |
print "R1: ", r1, ", C: ", c, "¥n"; | |
print "¥tTime: ", r1 * c * l(3), "(sec)"; | |
scale = defscale; | |
} | |
define mr(t, c) { | |
auto defscale; | |
defscale = scale; | |
scale = 6; | |
print "Time: ", t, ", C: ", c, "¥n"; | |
print "¥tR1: ", t / (c * l(3)); | |
scale = defscale; | |
} | |
af(1000, 10000, 0.00001); | |
ar(1, 0.6, 0.00001); | |
mt(1000, 0.00001); | |
mr(2, 0.00001); | |
quit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment