3 dynamic programming (pwm is running) example, 2 programming rules, 3 registers – Cirrus Logic EP93xx User Manual

Page 735: 3 dynamic programming (pwm is running) example -3, 2 programming rules -3, 3 registers -3, Table 24-2. dynamic programming steps -3, Table 24-3. pwm registers map -3

Advertising
background image

DS785UM1

24-3

Copyright 2007 Cirrus Logic

Pulse Width Modulator

EP93xx User’s Guide

2

4

2

4

24

24.2.1.3 Dynamic Programming (PWM is Running) Example

Note: Updates will take place at the end of the PWM cycle. Order of programming of the

Terminal Count and Duty Cycle is important. See

Section 24.2.2 on page 24-3

.

24.2.2 Programming Rules

1. Because the user can not tell the state of the PWM between cycles, care must be taken

while programming on the fly (while the PWM is running). To insure proper operation
observe the following rules to preserve the relationship of PWMxDutyCycle to
PWMxTermCnt:

A. If PWMxTermCnt (new) > PWMxTermCnt (current):

Program PWMxTermCnt (new) first then PWMxDutyCycle (new)

B. If PWMxTermCnt (new) < PWMxTermCnt (current):

Program PWMxDutyCycle (new) first then PWMxTermCnt (new)

If the rules “A” and “B” are not followed, a duty cycle of 100% may result until both

PWMxTermCnt and PWMxDutyCycle are updated.

2. Program PWMxTermCnt and PWMxDutyCycle with values that meet the specification.

3. When PWM is stopped (PWM_EN = 0), it does not stop immediately but waits for the

end of the current PWM cycle and then stops.

24.3 Registers

Note: All pwmout outputs will drive a logical “0” during reset. Coming out of reset, it will continue

to drive a logical “0”, and the PWM will be in halt mode.

Table 24-2. Dynamic Programming Steps

Step

Register

Value

Program TC value with 659

PWMxTermCnt

0x0293

Program DC value with 131

PWMxDutyCycle

0x0081

Table 24-3. PWM Registers Map

Address

Register

Name

Reset Value

Access

Size

0x8091_0000

PWM0TermCnt

PWM0 Terminal Count

0x0000

R/W

16

0x8091_0004

PWM0DutyCycle

PWM0 Duty Cycle

0x0000

R/W

16

0x8091_0008

PWM0En

PWM0 Enable

0x0000

R/W

16

0x8091_000C

PWM0Invert

PWM0 Invert

0x0000

R/W

16

0x8091_0020

PWM1TermCnt

PWM1 Terminal Count

0x0000

R/W

16

0x8091_0024

PWM1DutyCycle

PWM1 Duty Cycle

0x0000

R/W

16

0x8091_0028

PWM1En

PWM1 Enable

0x0000

R/W

16

0x8091_002C

PWM1Invert

PWM1 Invert

0x0000

R/W

16

Advertising