Chapter 1 Overview; Main Contents Of The Initial Settings; Contents Following The Main Loop - NEC 78K0S/K 1+ Series Application Note

External event counter
Hide thumbs Also See for 78K0S/K 1+ Series:
Table of Contents

Advertisement

An example of using the external event counter function of 16-bit timer/event counter 00 is presented in this sample
program. The LED output is reversed every 10 times (11 times only for the first reversal) the falling edge of the
external pulse input is detected.
1.1

Main Contents of the Initial Settings

The main contents of the initial settings are as follows.
Selecting the high-speed internal oscillator as the system clock source
Stopping watchdog timer operation
(low-voltage detection voltage) to 4.3 V ±0.2 V
Setting V
LVI
Generating an internal reset (LVI reset) signal when it is detected that V
supply voltage) becomes greater than or equal to V
Setting the CPU clock frequency to 8 MHz
Setting the I/O ports
Setting 16-bit timer/event counter 00
• Setting CR000 as a compare register
• Setting the external event counter compare value to CR000
• Setting the count clock as the valid edge (falling edge) of the TI000 pin
• Setting the operation mode to clear & start upon a match between TM00 and CR000
Enabling INTTM000 interrupts
Note This is set by using the option byte.
1.2

Contents Following the Main Loop

The LED output is reversed every 10 times (11 times only for the first reversal) the falling edge of the external pulse
input is detected, by using the generation of a 16-bit timer/event counter 00 interrupt (INTTM000), after completion of
the initial settings.
<Output>
LED
Caution For cautions when using the device, refer to the user's manual of each product (78K0S/KU1+,
78K0S/KY1+,

CHAPTER 1 OVERVIEW

TI000 pin
input signal
78K0S/KA1+
,78K0S/KB1+).
Application Note U18888EJ1V0AN
Note
DD
LVI
<Input>
The falling edge
is detected 10 times
is less than V
, after V
LVI
DD
<Output>
LED output reversal
LED
(power
3

Advertisement

Table of Contents
loading

This manual is also suitable for:

78k0s/ka1+78k0s/kb1+78k0s/ku1+78k0s/ky1+

Table of Contents