Roger Johnstone wrote:
A customer recently brought in a faulty timer board they wanted
replicated. All it had to do was switch on a load once every 24 hours
for a short time which was adjustable. The board looked overly
complicated so I traced out the circuit to see exactly what it was doing.
The original designer had used an 8-pin micro for the 24 hour timer, and
a 555 timer IC with a variable resistor for the adjustable time. The
best of both worlds!
We made a new board with a single 8-pin micro on it which performed both
functions. The resistor for the variable time is read by the micro
charging up a capacitor, then timing how long it takes to discharge it
through the resistor. I'm surprised no-one thought of doing that before ;
o)
I must admit the smallest uC I've used is a 16 pin device which had the
benefit of 3 analog inputs, so a pot wired as a voltage divider is the
only hardware required.
Of course, if all I had left was a digital input, I'd use the same
technique you did, or see other post alternative technique which works
a lot better when the sample rate needs to be constant, or even just
relatively high.