NEC UPD703116 User Manual page 312

32-bit single-chip microcontrollers
Table of Contents

Advertisement

(13) Capture/compare registers 101, 111 (CC101, CC111)
CC1n1 is a 16-bit register. It can be used as a capture register or as a compare register through specification
with capture/compare control register n (CCRn). CC1n1 can be read/written in 16-bit units.
Cautions 1. When used as a capture register (CMS1 bit of CCRn register = 0), write access is
prohibited.
2. When used as a compare register (CMS1 bit of CCRn register = 1) during TM1n
operation (TM1CEn bit of TMC1n register = 1), overwriting the CC1n1 register values is
prohibited.
3. When TM1n has been stopped (TM1CEn bit of TMC1n register = 0), the capture trigger is
disabled.
4. When the operation mode is changed from capture register to compare register, newly
set a compare value.
5. Continuous reading of CC1n1 is prohibited. If CC1n1 is continuously read, the second
read value may differ from the actual value. If CC1n1 must be read twice, be sure to read
another register between the first and the second read operation.
Correct usage example
Remark
n = 0, 1
15
14
13
CC101
15
14
13
CC111
(a) When set as a capture register
When CC1n1 is set as a capture register, the valid edge of either corresponding external interrupt signal
(INTP1n0 or INTP1n1) is selected with the selector, and the valid edge of the selected external interrupt
signal is detected as the capture trigger. TM1n latches the count value in synchronization with the
capture trigger (capture operation). The latched value is held in the capture register until the next capture
operation.
The valid edge of external interrupts (rising edge, falling edge, both rising and falling edges) is selected
with signal edge selection register 1n (SESA1n).
When the CC1n1 register is specified as a capture register, interrupts are generated upon detection of
the valid edge of either the INTP1n0 or INTP1n1 signal.
(b) When set as a compare register
When CC1n1 is set as a compare register, it always compares its own value with the value of TM1n. If
the value of CC1n1 matches the value of the TM1n, CC1n1 generates an interrupt signal (INTCC1n1).
312
CHAPTER 9 TIMER/COUNTER FUNCTION
CC101 read
CC111 read
CC101 read
CC111 read
12
11
10
9
8
7
12
11
10
9
8
7
User's Manual U14492EJ5V0UD
Incorrect usage example
CC101 read
CC101 read
CC111 read
CC111 read
6
5
4
3
2
1
6
5
4
3
2
1
0
Address
Initial value
FFFFF5E8H
0000H
0
Address
Initial value
FFFFF608H
0000H

Advertisement

Table of Contents
loading

Table of Contents