• AVR Freaks

Resolution Output compare

Author
giggio1990
New Member
  • Total Posts : 6
  • Reward points : 0
  • Joined: 2015/08/21 01:58:12
  • Location: 0
  • Status: offline
2015/11/11 06:59:14 (permalink)
0

Resolution Output compare

Hi,
 
I'm using dsPIC 33FJ256GP710A to generate a PWM signal.
I'd to know the resolution of Pwm; what is the limit of the duty cycle that can be set?
Thanks
 
LM
#1

4 Replies Related Threads

    NKurzman
    A Guy on the Net
    • Total Posts : 17839
    • Reward points : 0
    • Joined: 2008/01/16 19:33:48
    • Location: 0
    • Status: offline
    Re: Resolution Output compare 2015/11/11 13:03:59 (permalink)
    3 (1)
    How many angels can dance on the head of a pin.  That would depend on the size of the pin and the size of the angels
     
    Assuming you do not mean 0% and 100%  it is 16 bits so 1/65535 to 65534/65535
    The resolution is 65535.
    That is only true at a limited number of frequencies.
    #2
    Lubin
    Moderator
    • Total Posts : 375
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: Resolution Output compare 2015/11/11 13:55:55 (permalink)
    0
    Hi Luigi,
     
    The principle is similar than the one already described for Change Notification:Please have a look on this thread: http://www.microchip.com/forums/FindPost/892133
     
    If you use the Output Compare block to generate your PWM signal, you will find variables in the Matlab workspace as OC1max, OC2max, OC{x}max instead of CN{x}max for Change Notification.
    If you use the PWM peripheral, then you will get PWM{x}max variables in the workspace instead of CN{x}max...
     
    Lubin
    #3
    giggio1990
    New Member
    • Total Posts : 6
    • Reward points : 0
    • Joined: 2015/08/21 01:58:12
    • Location: 0
    • Status: offline
    Re: Resolution Output compare 2015/11/11 14:12:15 (permalink)
    0
    So, I have Max time setted to 5*10^-5 and OC1 =124. The ratio give me the resolution in seconds, and duty cycle? From processor datasheet i have seen that the resolution is the ratio between two frequencies, is it the same?
    post edited by giggio1990 - 2015/11/11 14:35:47
    #4
    Lubin
    Moderator
    • Total Posts : 375
    • Reward points : 5
    • Joined: 2007/03/31 07:38:15
    • Location: Bayonne, France
    • Status: offline
    Re: Resolution Output compare 2015/11/11 16:17:10 (permalink)
    3 (1)
    Hi Luigi,
     
    124 code for 50us
    1 code for 50e-6 /124 = 403 e-9. Resolution is 403 ns
     
    Duty cycle in percent is the raw value devided by 124.
    If you compute with your simulink model a duty cycle whose values are taken within 0 and 1, then you need to multiply by 124, convert result to uint16 and connect that result to the OC block input up (duty cycle) or down (duty cycle). Note that it is possible to use the OC1max variable within simulink to perform such scaling.
     
    FYI, The max time you provide allows the tool to determine the best setting for internal counter frequency that will provide the finest resolution which comply with this maximum time constraint.  
    #5
    Jump to:
    © 2019 APG vNext Commercial Version 4.5