- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello All
I am using timer component, while run time i want to change the timer period,
and as per this https://community.cypress.com/docs/DOC-12263
i wrote the code.
timer clock is 10Khz
default period is 900 (90ms)
i want to change it to 3000ms.
Timer_Start();
Timer_WritePeriod(30000);
Timer_WriteCounter(0);
isr_timer_StartEx(timer_int_handler);
after this lines of code the timer interrupt is activated in isr i wrote code to reset PSOC device.
the task is i had to reset the PSOC device whenever the timer count is completed and interrupted.
the period of timer is user changeable.
Is there any way to successfully do this.
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Attached is my trial, it seems that we need to use Timer_Enable() instead of Timer_Start() .
So my period setting function was
===============
void set_timer_period(int period)
{
Timer_Stop() ;
Timer_WriteCounter(0) ;
Timer_WritePeriod(period) ;
Timer_Enable() ;
}
===============
My TeraTerm log.
moto
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To be on the safe side you shoud stop the timer before changing period and resetting the actual count value to zero. After the changes start the timer again.
Bob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello BOB
This is what i wrote as you suggested but didn't work.
now i set the timer Period to 1000ms
but after this code the timing still not changed it is still 1000ms only.
Timer_Stop();
Timer_WritePeriod(30000);
Timer_WriteCounter(0);
isr_timer_StartEx(timer_int_handler);
Timer_Start();
Thanks
Paras
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Attached is my trial, it seems that we need to use Timer_Enable() instead of Timer_Start() .
So my period setting function was
===============
void set_timer_period(int period)
{
Timer_Stop() ;
Timer_WriteCounter(0) ;
Timer_WritePeriod(period) ;
Timer_Enable() ;
}
===============
My TeraTerm log.
moto