OC minimum to maximum range

Post Reply
resodad
Posts: 71
Joined: Tue Jul 07, 2009 1:06 pm
Location: West Point, New York

OC minimum to maximum range

Post by resodad » Thu Jun 16, 2011 9:03 pm

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
Attachments
Push_to_PWM.jpg
Pushbutton_to_PWMv2.mdl
(65.52 KiB) Downloaded 721 times

LubinKerhuel
Site Admin - Expert
Posts: 616
Joined: Wed Mar 07, 2007 11:23 pm
Location: Bayonne- France
Contact:

Re: OC minimum to maximum range

Post by LubinKerhuel » Fri Jun 17, 2011 7:39 am

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...
Lubin

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests