PDA

View Full Version : Using multiple SLEEP for long delays ?



Sam
- 25th March 2016, 13:36
I recently built a gate opener and programmed a 12F675 to control it via wireless remote. I have a 12v Sealed Lead Acid battery as power,

I've looked at many, many float charger circuits and decided to just program a PIC to close a relay which will allow a trickle charge to top off the battery every, say 100 to 150 hours for a period of about an hour or whatever is needed. (TBD)

I've tried Darrel's "Elapsed timer" but I can't get it to work in this application, "Ticks" seem to be seconds and "Seconds" seem to be minutes, not sure.

Anyway, can I just use multiple SLEEP commands of 65,535 seconds (18+ hours) to achieve the desired delay between charging pauses ?

Or, can anyone suggest a better method ?

Thanks for any advise

pedja089
- 25th March 2016, 13:57
You can, or put SLEEP in FOR loop.

HenrikOlsson
- 25th March 2016, 14:00
Sure, you can use multiple SLEEP periods and keep track of them, just remember that the SLEEP period isn't very accurate and may (will) change with temperature and even from device to device but in your application I don't think it matters if it differes an hour or two in the end.

There are of course other ways of doing it but, if accuracy isn't an issue, none that is as convenient as SLEEP - not that I can think of anyway.

/Henrik.

Sam
- 25th March 2016, 14:39
Great, thanks very much guys ! I'll do a FOR/NEXT routine.