![HORNER HE-XE100 Скачать руководство пользователя страница 98](http://html.mh-extra.com/html/horner/he-xe100/he-xe100_user-manual_2163928098.webp)
MAN0878-09-EN_XLE_XLT_UserManual
A u g u s t 2 3 , 2 0 1 8
P a g e 98 | 158
12.6 PWM Examples
All of the PWM examples use the following formula.
Frequency =
(
)
t
PeriodCoun
escale
+
1
Pr
000
,
000
,
32
Example 1
To get a 50% Duty Cycle @ 10 kHz waveform on PWM1:
Set %AQ1 = 50 (duty cycle count)
Set %AQ5 = 30 (prescale count)
Set %AQ7 = 100 (period count)
Example 2
To get a 50% Duty Cycle on PW1 and 90 % Duty Cycle on PWM2 @ 1 kHz waveform:
Set %AQ1 = 500 (duty cycle count)
Set %AQ3 = 900 (duty cycle count)
Set %AQ5-6 = 30 (prescale count)
Set %AQ7-8 = 1000 (period count)
Example 3
To turn PWM 1 output ON all the time
Set %AQ1-2 = Same value as AQ7-8 (duty cycle count)
Set %AQ5-6 = Any value (prescale count)
Set %AQ7-8 = Non-Zero value (period count)
Example 4
To turn PWM 1 output OFF all the time
Set %AQ1-2 = 0 (duty cycle count)
Set %AQ5-6 = Any value (prescale count)
Set %AQ7-8 = Any value <or> 0 (period count)