Output Compares on ZB Programmable


Are the Output Compares free running and periodic? If I set one up with init=0, max=100, mode=toggle, will it continue to toggle indefinitely on its own, or do I need to have the interrupt service routine reset it to fire again after 100 more ticks?

I want it to be free-running, and in the ISR all I really want to do is set the next state to either CLEAR or SET depending on the data.

I am implementing a funny protocol where every bit is divided into two halves, with a ‘0’ bit being sent as “HIGH-LOW” and a ‘1’ bit being set as a “HIGH-HIGH”. It seemed like I would be less susceptible to jitter due to interrupt latency if I use the output compare function, so that the timer sets the pin at precisely the correct time and my ISR has a 1/2 bit time (10 usec) to set it up for the next one.


Hi Chris,

The output-compare does not set the next timeout automatically, that must be done in the pin’s ISR with the ocompare_set_timeout(). On the other hand, the timer is not stopped, so precision is not lost.

I think that you will find the example “Waveform generation” very useful as it uses output-compare to generate a square-wave by toggling and a “burst-wave” depending on data in an array.