Operation As External Event Counter - NEC 78K0/KB1+ Preliminary User's Manual

8-bit single-chip microcontrollers
Table of Contents

Advertisement

7.4.2 Operation as external event counter

The external event counter counts the number of external clock pulses to be input to the TI50 pin by 8-bit timer
counter 50 (TM50).
TM50 is incremented each time the valid edge specified by timer clock selection register 50 (TCL50) is input.
Either the rising or falling edge can be selected.
When the TM50 count value matches the value of 8-bit timer compare register 50 (CR50), TM50 is cleared to 0
and an interrupt request signal (INTTM50) is generated.
Whenever the TM50 count value matches the value of CR50, INTTM50 is generated.
Setting
<1> Set each register.
• Set port mode register 1 (PM17) to 1.
• TCL50: Select TI50 pin edge.
TI50 pin falling edge → TCL50 = 00H
TI50 pin rising edge → TCL50 = 01H
• CR50:
Compare value
• TMC50: Stop the count operation, select clear & start mode entered on match of TM50 and CR50,
disable the timer F/F inversion operation, disable timer output.
(TMC50 = 0000××00B × = Don't care)
<2> When TCE50 = 1 is set, the number of pulses input from the TI50 pin is counted.
<3> When the values of TM50 and CR50 match, INTTM50 is generated (TM50 is cleared to 00H).
<4> After these settings, INTTM50 is generated each time the values of TM50 and CR50 match.
Figure 7-8. External Event Counter Operation Timing (with Rising Edge Specified)
TI50
Count start
TM50 count value
CR50
INTTM50
N = 00H to FFH
150
CHAPTER 7 8-BIT TIMER/EVENT COUNTER 50
00
01
02
03
04
Preliminary User's Manual U16846EJ1V0UD
05
N–1
N
N
00
01
02
03

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ypd78f0101hYpd78f0102hYpd78f0103h

Table of Contents