- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I would like to change period and compare value directly in TC interrupt handler with API during running Timer/Counter of PSoC4000S.
Is there no problem?
Or can we only use swap of PWM instead of Timer/Counter?
Best regards,
Yocchi
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yocchi,
This KBA might be helpful:
Basically, in running Timer/Counter or PWM, a new value value will take effect after tc overflow (next period).
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yocchi,
First question:
Yes, there is no problem to change the period and compare value in the TC interrupt handler.
Second question:
I think you should describe which function you want to achieve.
Could you offer us more information to decide whether it could be achieve.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Thank you very much for your reply.
About first question, I am concerned about making a misjudgment when the comparison with the counter value occurs at the moment of writing the period and compare value.
Do you still think there is no problem?
Best regards,
Yocchi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yocchi,
This KBA might be helpful:
Basically, in running Timer/Counter or PWM, a new value value will take effect after tc overflow (next period).
/odissey1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
In conculsion, I will use swap function.
I set switch enable of Timer_1 in hardware. and enable the swap with API in software.
Timer_1_SetPeriodSwap(1);
It can run well.
Best regards,
Yocchi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
In KBA90554 , it is written that the period or compare value is larger or smaller than counter value.
If the period/compare register of the timer/counter(PWM) is asynchronous clocking, the malunction should occur
like "In the case of asynchronous clocking".
If it is synchronous clocking, there is no malfuncion like "In the case of synchronous clocking"
Which type it was made?
Best regards,
Yocchi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Yocchi,
The TCPWM runs in the asynchronous clock like you described in the previous response (first figure).
We don't recommend you change the period value and let it act in the current cycle.
You can call the API: void PWM_1_WritePeriodBuf(uint32 periodBuf) to change the period. If you use this way, it will take effect after TC event.
Thanks,
Lingling
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Lingling-san,
It became clear.
I really appreciate your help.
Best regards,
Yocchi