- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am trying to create a delay timer that is settable before it runs. Currently, I am just executing the WritePeriod() method.
The datasheet does say that "The period of the Timer does not change until the counter is reloaded from the period register."
What is the best method to reload the counter without having the timer run once? I have the timer implemented as a fixed function, not with UDB.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BRSHiFi,
Here is a very short and quick example of the Timer period reload that occurs as fast as the SW can implement.
The project has an array of different period values which changes on a SW1 press.
The Timer is in continuous mode with the same period until the SW1 press.
You are correct. My suggestion:
Timer_Stop(); /* Stop/Disable the Timer */
Timer_WritePeriod(new_period); /* Load new period */
Timer_Enable() /* restart the Timer with the new Period.*/
Is not sufficient for an immediate reload of the period.
According to the Timer datasheet, the reload of the period occurs on the Terminal Count (TC) or a reset.
In this project, I used a Control Register bit to strobe the reset pin of the Timer right after changing the Period.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Try:
Timer_Stop(); /* Stop/Disable the Timer */
Timer_WritePeriod(new_period); /* Load new period */
Timer_Enable() /* restart the Timer with the new Period.*/
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It works fine the first time.
When run again with a new time, the new time does not register. It still runs with the old period.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Much appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
BRSHiFi,
Here is a very short and quick example of the Timer period reload that occurs as fast as the SW can implement.
The project has an array of different period values which changes on a SW1 press.
The Timer is in continuous mode with the same period until the SW1 press.
You are correct. My suggestion:
Timer_Stop(); /* Stop/Disable the Timer */
Timer_WritePeriod(new_period); /* Load new period */
Timer_Enable() /* restart the Timer with the new Period.*/
Is not sufficient for an immediate reload of the period.
According to the Timer datasheet, the reload of the period occurs on the Terminal Count (TC) or a reset.
In this project, I used a Control Register bit to strobe the reset pin of the Timer right after changing the Period.
"Engineering is an Art. The Art of Compromise."
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mission accomplished. That did the job.
Appreciated the help.