Hello Lubin and all,
I would like to produce a 1kHz PWM signal that varies in duty cycle from 0 to 100% in 10% steps.
Please see attached simulink file.
I control the duty cycle by counting presses of a button from 0 to 10.
OC produces the correct signal except at 100%.
At 100%, the wave form is high for 995 microseconds and the frequency drops to 380 Hz.
2 posts • Page 1 of 1
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Marseille - France
resodad wrote:At 100%, the wave form is high for 995 microseconds and the frequency drops to 380 Hz.
OC block compute a signal using interrupt and change during the interrupt values for the next event to appears... Thus very fast event such as 1% or 99% might not work properly. (due to software handling)
Anyway, for 100% and 0% typical value, I thought added tricky code to make theses special value owrking. Perhaps that it does not work with PIC32. (mainly tested with 16 bits pic).
Anyway, could you give a try replacing the OC block with the OC_HW block ?
Thus, I'll try to have a closer look on your question, but it is difficult for me to do it before the end of next week. I apologize for the delay...
Users browsing this forum: No registered users and 1 guest