Created
February 5, 2011 04:29
-
-
Save laclefyoshi/812203 to your computer and use it in GitHub Desktop.
Astable mode of 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
def aFreqCalculate(info): | |
r1 = info["r1"] | |
r2 = info["r2"] | |
c = info["c"] | |
t1 = math.log(2) * (r1 + r2) * c # Time of HIGH | |
t2 = math.log(2) * r2 * c # Time of LOW | |
total = t1 + t2 | |
freq = 1 / total | |
duty = t1 / total | |
print "R1: %d, R2: %d, C: %f¥n¥tHIGH:%f + LOW:%f = TOTAL:%f(sec)" ¥ | |
% (r1, r2, c, t1, t2, total) | |
print "¥tFreq: %f(Hz)¥n¥tDuty: %f" % (freq, duty) | |
# math.log(2) = 0.693 | |
def aResisterCalculate(info): | |
f = info["freq"] | |
d = info["duty"] | |
c = info["c"] | |
r1 = (2 * d - 1) / (f * c * math.log(2)) | |
r2 = (1 - d) / (f * c * math.log(2)) | |
print "Freq: %f(Hz), Duty: %f, C: %f" % (f, d, c) | |
print "¥tR1: %f, R2: %f¥n¥tTOTAL: %f(sec)" % (r1, r2, 1 / f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment