1

A zero detector crossover sends a pulse to the arduino, it must start counting x time and then a pulse is sent from the arduino, once the timer reaches time x, it must stop counting and only start counting again until it receives the new pulse of the zero crossing detector, the idea is to do something like this

enter image description here

what I don't know is how to keep the timer off all the time toff that appears in the image

4
  • A zero detector crossover sends a pulse to the arduino... How does your code and wiring detect the zero cross-over now? Is the detector external and just sends a signal to Arduino? Wouldn't you just reset the timer any time you detected the cross-over to positive? Or doesn't the detector distinguish between a positive crossing and a negative one? Or are you really wanting to know how to do a cross-over detection for a sinusoidal signal?
    – lurker
    Apr 17 at 1:40
  • @lurker what I get from the zero crossing detector is a train of pulses, which varies from 0 to 5v each time it passes through zero, but that's not the point, create an edge ISR when the signal varies, at that time it should start the counting, stop when it reaches the time x that I need and stay off until the next zero edge, in the examples that I have seen the timer restarts and continues counting, I need it to turn off or stop counting until the next zero crossing Apr 17 at 2:43
  • 1
    Does this answer your question? Fan regulator control from Arduino
    – Juraj
    Apr 17 at 6:25
  • You can trick the timer into doing one-shot, by setting the counter to a value higher than TOP. See hackaday.com/2015/03/24/…
    – Gerben
    Apr 17 at 15:51
2

the way to turn off the Timer is to set the CS12, CS11 and CS10 prescale bits to 0, in this way the CLK signal is disconnected and the timer stops counting, when you want the timer to continue counting, they are set back to 1 the CS12, CS11 and CS10 bits according to the selected prescale

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.