How to remember the number of power switch, Note:the power is main power,if the power off time is too long,MCU was stop working. sod ,off time less then 400ms,and MCU have a big cap to save power. question: if on/off power switch 1 times MCU output 500Hz on/off power switch 2 times MCU output 1000Hz .................................... anyone have a method? thx you .
Another way to do it is to NOT power the MCU down at all, just the rest of the circuit. You can put the CPU to sleep, so power use is next to zero and just keep the timer block running. If you can access the mains, you can also count zero crossings to determine the time as well.
yo vipy mate.
this idea is great , which I/O pin can be use? can you suggest? i want MCU working mode: when switch is pwoer off,mcu into sleep mode,and timer start.when power switch on. mcu into normal mode ,dispose continuance time from power off to power on . it is OK? thx you.
which I/O pin can be use there is, in this thread, no indication, whatsoever which uC you use. so the answer is "pin x"
Erik
Saving to data on power down usually implement a separation of mcu vcc to the rest using a low Vf diode and a buffer cap, an analog comparator or adc of the mcu detect the voltage drop on the main supply indicating a power switched off. At first power on just do 500Hz, if a short power off detected then switch mode to 1000 Hz, another one switched back to 500Hz, and so on.
A side note, disable all I/O immediately at power off detected - do not let your high current led driver drain the buffer cap to fast.. :->
portpin 1.4 is the best
(either interrupt pin or a pin gating a timer) P1.4 is neither on any derivative I know of. anyhow stating a specific pin without knowing the actual derivative is outright ridiculous.
hi vip chummy boy.
thx for the ace detail. i will use p1.4
i o u 1
u r the best :->
.
No - the same person communicating with himself because of his erratic brain patterns. But then again, communicating with himself is the best way to get responses saying how clever he is.
Maturity comes with age - or sometimes never.
hey vip.
can you fb or skype me now.