![background image](http://html.mh-extra.com/html/nec/mpd703030a/mpd703030a_user-manual_249261227.webp)
CHAPTER 7 TIMER/COUNTER FUNCTION
User’s Manual U13850EJ4V0UM
227
7.4.5 Operation as interval timer (16 bits)
(1) Cascade connection (16-bit timer) mode
The V850/SB1 and V850/SB2 provide a 16-bit register that can be used when connecting in cascade.
The available registers are as follows.
TM2, TM3 cascade connection:
16-bit counter TM23 (Address: FFFFF24AH)
16-bit compare register CR23 (Address: FFFFF24CH)
TM4, TM5 cascade connection:
16-bit counter TM45 (Address: FFFFF26AH)
16-bit compare register CR45 (Address: FFFFF26CH)
TM6, TM7 cascade connection:
16-bit counter TM67 (Address: FFFFF28AH)
16-bit compare register CR67 (Address: FFFFF28CH)
By setting bit 4 (TMCn4) of 8-bit timer mode control register n (TMCn) to 1, the timer enters the timer/counter
mode with 16-bit resolution (n = 2 to 7).
With the count preset in 8-bit compare register n (CRn0) as the interval, the timer operates as an interval timer
by repeatedly generating interrupts (n = 2 to 7).
The following shows a setting method when using TM2 and TM3. When using TM4 and TM5 or TM6 and TM7,
substitute them for TM2 and TM3.
Setting method (TM2, TM3 cascade connection)
(1) Setting registers
•
TCL20, TCL21: Select the count clock for TM2 (setting not necessary for TM3 because of cascade
connection).
•
CR20, CR30:
Compare value (00H to FFH can be set for compare values)
•
TMC2:
Selects clear & start mode on a match of TM2 and CR2 (x: don’t care)
[TM2
→
TMC2 = 0000xxx0B, TM3
→
TMC3 = 0001xxx0B]
(2) Set the TCE3 bit of TMC3 to 1. After that, set the TCE2 bit of TMC2 to 1 to start the count operation.
(3) When the TM23 and CR23 values of the timer connected in cascade match, INTTM2 of TM2 is generated
(TM2 and TM3 are cleared to 00H).
(4) IMTTM2 is then repeatedly generated at the same interval.
Cautions 1. When 8-bit timers (TM2, TM3) are connected in cascade and used as a 16-bit timer (TM23),
change the setting value of the compare register (CR23) after stopping the count operation
of the 8-bit timers connected in cascade.
If the value of CR23 is changed without stopping the timers, the values of the higher 8 bits
(TM3) become undefined.
2. Even during cascade connection, the interrupt request (INTTM3) of higher timer 3 (TM3) is
generated when the count value of higher timer 3 (TM3) matches CR30. Be sure to mask
TM3 to disable this interrupt.
3. To set the TCEn bit, set TCE2 after TCE3 is set.
4. The count can be started or stopped by setting the TCE2 bit of TMC2.
Содержание MPD703030A
Страница 2: ...User s Manual U13850EJ4V0UM 2 MEMO ...
Страница 514: ...User s Manual U13850EJ4V0UM 514 MEMO ...