bradb
- 8th August 2009, 05:59
I'm working on building a circuit to keep tracking of machine online time (An electronic hour meter). I'd like to do this with 2 wires, a 12 volt power while running and ground.
My thought of the circuit is to use an IOC pin to detect when power is removed from the circuit. To keep power to the chip I want to use a large cap, the cap size will need to be determined once I get power consumption and time needed to shut down safely, but I'm thinking as long as I keep 90% of the charge on the cap for at least 50ms, that should be plenty of time.
Basically when power is removed from the circuit, the IOC will interrupt instantly. I'll write my counter vairables from Timer 1 into eeprom using a DT Interupt routine, then set the chip into nap mode. As long as my cap is big enough I should have plenty of time to write my vars to the EEPROM (Green circled cap).
When the circuit is powered up, I'll read my eeprom vars and then continue counting. Does anyone want to throw $.02 in on the design? Thoughts?
I'll have no issue writing the code, I'm just wondering about using the large cap to store enough power to write the vars to eeprom.
Thanks
Brad
http://74.219.236.172/timing.jpg
My thought of the circuit is to use an IOC pin to detect when power is removed from the circuit. To keep power to the chip I want to use a large cap, the cap size will need to be determined once I get power consumption and time needed to shut down safely, but I'm thinking as long as I keep 90% of the charge on the cap for at least 50ms, that should be plenty of time.
Basically when power is removed from the circuit, the IOC will interrupt instantly. I'll write my counter vairables from Timer 1 into eeprom using a DT Interupt routine, then set the chip into nap mode. As long as my cap is big enough I should have plenty of time to write my vars to the EEPROM (Green circled cap).
When the circuit is powered up, I'll read my eeprom vars and then continue counting. Does anyone want to throw $.02 in on the design? Thoughts?
I'll have no issue writing the code, I'm just wondering about using the large cap to store enough power to write the vars to eeprom.
Thanks
Brad
http://74.219.236.172/timing.jpg