- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
From what I understand, the Timer component will reload the period register everytime it gets to 0.
Can I simply write the count = 0 to force the timer to start over ?
For example, I want to add a timeout to a serial rx routine...
CY_ISR(mytimerint){
Timer_ReadeStatusRegister(); //clear interrupt
timeout = 1;
}
in my routine.........
timeout = 0;
Timer_WriteCounter(0);
while(!timeout){
//do my stuff
}
- Labels:
-
PSoC 5LP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looking through previous posts, I note this issue of being able to reset the timer to form non-blocking version of CyDelay come sup time and again.
Has Cypress not come up with a non-blocking timer function yet? It seems to me that dropping down components and using control components and logic levels simply to get a non-blocking timeout funtion is convoluted.
It appears in my previous post, I would also need to stop the timer before setting counter value and then restart. So, to get a simple non-blocking timeout function I need to set up a volatile flag, create a timer interrupt that sets the flag and clears the interrupt then in code. I need to place a Timer, Low digital level, Clock and isr on the work sheet and then in the main code have to stop the timer, set counter value to 0, reset the timeout flag and start the time again.
Something real simple like below would seem more convenient to me...
CyTimeout(100);
While(!CyTimedOut){
//do stuff
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, you are quite right. This is the exactly the code I used for my own. I'm afraid Cypress cannot provide us with every solution, some we have to do ourselves. You may of course write your own timer/timeout components and use them where required.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A HW reset via control reg would be an option .....
Regards, Dana.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content