beautypg.com

Horner APG XL6 OCS User Manual

Page 57

background image

MAN0883-05-EN

CH.11

March 4, 2010

Page 57 of 135

#1037

Frequency =

(

)

t

PeriodCoun

t

escaleCoun

×

+1

Pr

000

,

000

,

16

• Period

Count

This value (%AQ7-8) sets the period of the output signal by specifying the number of internal
PWM counter counts before the cycle is reset (larger count results in a smaller frequency). The
duration of each count is determined by the prescaler value. This parameter affects the Period of
both PWM outputs.

See the previous formula to see how the prescale and period counts create an output frequency.
For example, setting the PWM for 1 µs resolution (prescale=15), and a period count of 20,000
would result in a 50 Hz output.

• Duty

Cycle

Count

This value (PWM1: %AQ1-2, PWM2: %AQ3-4) sets the width of the output signal by specifying
the number of internal PWM counter counts that the output is maintained high. The duration of
each count is determined by the prescaler value. Each PWM channel has its own duty cycle
count parameter.

Setting the period count to 1000 and the duty cycle count to 500 results in a duty cycle of 50
percent. Changing just the duty cycle count to a value of 250 results in a duty cycle of 25
percent.

At controller power-up or during a download, the PWM output is maintained at zero until
both the Period (count) and the Duty cycle (count) are loaded with non-zero values.
When the controller is placed in stop mode, the state of the PWM outputs is dependent
on the PWM State on Controller Stop configuration. This configuration allows for either
hold-last-state or specific prescale, period and duty cycle counts. Specifying zero for
either the period or duty causes the PWM output to remain low during stop mode.

Note that the nominal output driver turn-on-time delay (to reach 50% output) is 25
microseconds. Therefore, this limitation should be considered when determining both
the minimum pulse width and the duty cycle accuracy of the application.

Period

Duty Cycle