8XC196MC, MD, MH USER’S MANUAL

PWM_PERIOD

Address:

1FB4H

 

Reset State:

00H

The PWM period (PWM_PERIOD) register controls the period of the PWM outputs. It contains a value that determines the number of state counts necessary for incrementing the PWM counter. The value of PWM_PERIOD is loaded into the PWM period count register whenever the count equals zero.

 

7

0

 

 

 

PWM Period

 

 

 

 

 

 

Bit

Function

 

 

Number

 

 

 

 

 

 

 

 

 

7:0

PWM Period

 

 

 

This register controls the period of the PWM outputs. The value of PWM_PERIOD is

 

 

 

loaded into the PWM period count register whenever the count equals zero.

 

 

 

 

 

 

 

 

 

 

 

Figure 10-3. PWM Period (PWM_PERIOD) Register

 

10.5 PROGRAMMING THE DUTY CYCLE

The values written to the PWMx_CONTROL and PWM_PERIOD registers control the width of the high pulse, effectively controlling the duty cycle. The 8-bit value written to the control regis- ter is loaded into a buffer, and this value is used during the next period. Use the following duty cycle formula to calculate a desired duty cycle for given values of PWMx_CONTROL and PWM_PERIOD, and then write these values to the appropriate registers.

Duty Cycle (in %)

=

PWM-----------------x---_----CONTROL------------------------------

× 100

 

 

PWM_PERIOD + 1

 

Pulsewidth (in µs)

=

Duty Cycle × TPWM

 

-----------------------------------------------

 

 

 

100

 

where:

PWMx_CONTROL

=

8-bit value to load into the PWMx_CONTROL register

PWM_PERIOD

=

8-bit value to load into the PWM_PERIOD register

Pulsewidth

=

width of each high pulse

TPWM

=

output period on the PWM pin, in μs

10-6

Page 233
Image 233
Intel 8XC196MC, 8XC196MD, 8XC196MH manual Programming the Duty Cycle, Pwmperiod +