beautypg.com

5 16-bit software timer mode – Rainbow Electronics T89C51CC01 User Manual

Page 111

background image

111

T89C51CC01

Rev. D – 17-Dec-01

Figure 42. PCA Capture Mode

16.5 16-bit Software
Timer Mode

The PCA modules can be used as software timers by setting both the ECOM and MAT
bits in the modules CCAPMn register. The PCA timer will be compared to the module’s
capture registers and when a match occurs an interrupt will occur if the CCFn (CCON
SFR) and the ECCFn (CCAPMn SFR) bits for the module are both set.

Figure 43. PCA 16-bit Software Timer and High Speed Output Mode

CEXn
n = 0, 4

PCA Counter

CH

(8bits)

CL

(8bits)

CCAPnH CCAPnL

CCFn

CCON

PCA
Interrupt
Request

-

0CAPPnCAPNn000ECCFn

7

CCAPMn Register (n = 0, 4)

0

CCAPnL

(8 bits)

CCAPnH

-

ECOMn0 0 MATn TOGn0 ECCFn

7

0

CCAPMn Register

(n = 0, 4)

CH

(8 bits)

CL

(8 bits)

16-Bit

Com-

parator

Match

Enable

CCFn

CCON reg

PCA
Interrupt
Request

CEXn

Compare/Capture Module

PCA Counter

“0”

“1”

Reset

Write to

CCAPnL

Write to CCAPnH

For software Timer mode, set ECOMn and MATn.
For high speed output mode, set ECOMn, MATn and TOGn.

Toggle