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.
What's wrong?
Regards,
John
OC minimum to maximum range
OC minimum to maximum range
- Attachments
-
- Pushbutton_to_PWMv2.mdl
- (65.52 KiB) Downloaded 721 times
-
- Site Admin - Expert
- Posts: 616
- Joined: Wed Mar 07, 2007 11:23 pm
- Location: Bayonne- France
- Contact:
Re: OC minimum to maximum range
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)resodad wrote:At 100%, the wave form is high for 995 microseconds and the frequency drops to 380 Hz.
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...
Lubin
Who is online
Users browsing this forum: No registered users and 4 guests