• AVR Freaks

Hot!Continuous output pulses vs. PWM

Author
dlindbergh
Super Member
  • Total Posts : 479
  • Reward points : 0
  • Joined: 2006/09/11 18:17:11
  • Location: Boston USA
  • Status: offline
2010/02/15 14:19:09 (permalink)
0

Continuous output pulses vs. PWM

I don't understand the difference between OCM<2:0> mode 110 (PWM mode) and mode 101 (initialize low, then continuous output pulses).

In either mode you can get a variable duty cycle PWM output by setting up the peripheral and then changing just one register to change the duty cycle.

So why are they both there?  Is there some advantage to using one mode vs. the other?

In mode 110 (PWM) you'd set:

PRx = the PWM period
OCxRS = pulse "high" period
OCxR = OCxRS


In mode 101 (continuous output pulses) you'd set:

PRx = the PWM period
TMRx = PRx value
OCxR = 0
OCxRS = pulse "high" period

Other than the initialization procedure, what's the difference?


#1

3 Replies Related Threads

    dlindbergh
    Super Member
    • Total Posts : 479
    • Reward points : 0
    • Joined: 2006/09/11 18:17:11
    • Location: Boston USA
    • Status: offline
    RE: Continuous output pulses vs. PWM 2010/02/15 14:23:14 (permalink)
    0
    Nevermind - I figured it out.

    In mode 101 you have to be careful about WHEN you change the OCxRS register to alter the duty cycle - esp. if you're reducing the value.  Otherwise the pulse could stay high for much longer than you intended (till it wraps around).

    With PWM mode you don't have to worry about that.

    (I'd delete the thread if I knew how.)
    #2
    Gyrometer
    Senior Member
    • Total Posts : 139
    • Reward points : 0
    • Joined: 2010/02/10 01:38:10
    • Location: Australia
    • Status: offline
    RE: Continuous output pulses vs. PWM 2010/02/19 07:12:52 (permalink)
    0
    dlindbergh,
    Keep the thread,
    I found it useful as I had a similar question.
    Steve
    #3
    StefaniMW
    Starting Member
    • Total Posts : 29
    • Reward points : 0
    • Joined: 2015/11/08 09:09:54
    • Location: USA
    • Status: offline
    Re: RE: Continuous output pulses vs. PWM 2019/11/13 13:08:32 (permalink)
    0
    Thank you for this thread.  I had the same question and now I understand.
     
    #4
    Jump to:
    © 2019 APG vNext Commercial Version 4.5