This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to remember the number of power switch

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 .

Parents
  • You guys are not understanding the problem. my dear friend wants to turn the power on once to select 500kHz, twice within a short interval to select 1MHz. He needs to count off time, so an EEPROM isn't going to work.

    A simple RC on the power supply with a reasonably high time constant. Power up and look at that voltage as the first thing you do. If it was powered before that voltage will be higher than if it wasn't. Up to you if you want to control the discharge with another resistor. Make sure you diode isolate this RC so it is not discharged by the rest of the circuit when powered down.

    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.

Reply
  • You guys are not understanding the problem. my dear friend wants to turn the power on once to select 500kHz, twice within a short interval to select 1MHz. He needs to count off time, so an EEPROM isn't going to work.

    A simple RC on the power supply with a reasonably high time constant. Power up and look at that voltage as the first thing you do. If it was powered before that voltage will be higher than if it wasn't. Up to you if you want to control the discharge with another resistor. Make sure you diode isolate this RC so it is not discharged by the rest of the circuit when powered down.

    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.

Children