Home/Support/Support Forum/High Resolution Timer timer_enable() not working as expected

High Resolution Timer timer_enable() not working as expected

0 votes
I have a project where I need to send an impulse to a relay. If the XBee module receives a valid command, a relay will be triggered for 125ms. For this purpose I wanted to use the High Resolution Timer (ONE_SHOT).

So I:

1. Configured my timer accordingly:
timer_config(relayTimer, FALSE, ONE_SHOT, 125000);
(this call returned 0 to indicate success)

2. I tried to enable the timer when needed:
timer_enable(relayTimer, TRUE);

But nothing happened!? Interestingly, the API for timer_enable doesn't return anything so I can't tell if the timer was enabled correctly.

If I configure the timer to start immediately, it works as expected. I also tried to start a periodic timer with individual calls:
timer_set_timeout(relayTimer, 125000); timer_set_mode(relayTimer, PERIODIC); timer_irq_enable(relayTimer, TRUE); timer_enable(relayTimer, TRUE);

But this didn't work either... So.. should it work? False expectations? Something wrong on my end? I have no issues calling the timer_config() to start immediately but I keep wondering why can't I start a configured timer that's disabled?

API Reference: http://exsilium.github.io/xbee-sdk-doc/group__api__timer.html
asked Oct 3, 2016 in XBee Programmable Development by exile Community Contributor (92 points)
edited Oct 3, 2016 by exile

Please log in or register to answer this question.

1 Answer

0 votes
Try looking over
answered Dec 2, 2016 by mvut Veteran of the Digi Community (15,107 points)
Based on the programming guide it should work as I expected but for some reason, it doesn't. Or did you wan't to highlight something specific?