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:
Code:
timer_config(relayTimer, FALSE, ONE_SHOT, 125000);
(this call returned 0 to indicate success)

2. I tried to enable the timer when needed:
Code:
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:
Code:
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 http://127.0.0.1:56775/help/topic/com.digi.xbee.api.doc/html/1.6.0/pg/pg_hr_timer.html?resultof=%22%48%69%67%68%22%20%22%68%69%67%68%22%20%22%72%65%73%6f%6c%75%74%69%6f%6e%22%20%22%72%65%73%6f%6c%75%74%22%20%22%74%69%6d%65%72%22%20%22%41%50%49%22%20%22%61%70%69%22%20
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?

http://xbee-sdk-doc.readthedocs.io/en/latest/api_doc/pg/#113-high-resolution-timer
...