em78p164n ELAN Microelectronics Corp, em78p164n Datasheet - Page 42

no-image

em78p164n

Manufacturer Part Number
em78p164n
Description
8-bit Microcontroller With Otp Rom
Manufacturer
ELAN Microelectronics Corp
Datasheet
EM78P164N
8-Bit Microcontroller with OTP ROM
36 •
5.7.4 PWM Duty Cycle (DTX: TMRH/DTL)
The PWM duty cycle is defined by writing to the DTX register, and is latched from DTX
to DLX while TMRX is cleared. When DLX is equal to TMRX, the PWMX pin is cleared.
DTX can be loaded anytime. However, it cannot be latched into DLX until the current
value of DLX is equal to TMRX.
The following formula describes how to calculate the PWM duty cycle:
Example:
5.7.5 Comparator
Changing the output status while a match occurs will set the TMRIF flag at the same
time.
5.7.6 PWM Programming Process/Steps
Load PRD with the PWM time period.
1. Load DT with the PWM Duty Cycle.
2. Enable interrupt function by writing IOCF0, if required.
3. Set PWMX pin to be output by writing a desired value to RB.
4. Load a desired value to IOC9 with TMR prescaler value and enable both PWM and
5.8 Timer
5.8.1 Overview
The Timer (TMRX) is a 10-bit clock counter with programmable prescalers. It is designed
for the PWM module as baud rate clock generator. TMRX can be read only. The Timer
will stop running when sleep mode occurs.
TMR.
DTX = 10;
Then
Duty
cycle
Duty
=
Fosc = 4 MHz;
cycle
(
DTX
)
=
×
( )
(This specification is subject to change without further notice)
10
⎜ ⎜
F
OSC
1
×
⎟ ⎟
4
TMRX (0, 0, 0) = 1 : 1,
×
Product Specification (V1.4) 05.28.2010
1
M
(
TMRX
×
=
prescale
2
5 .
μs
value
)

Related parts for em78p164n