NEC 78K0S/K 1+ Series Application Note page 32

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

Advertisement

main.c (C language version)
/***************************************************************************
NEC Electronics
****************************************************************************
78K0S/KB1+
****************************************************************************
16-bit timer 00 (external event counter)
****************************************************************************
<<History>>
2007.7.--
****************************************************************************
<<Overview>>
This sample program presents an example of using the external event counter
function of 16-bit timer 00.
interrupt every 10 times the falling edge of the external clock pulse input
to the TI000 pin is counted.
<Principal setting contents>
- Declare a function run by an interrupt: INTTM000 -> fn_inttm000()
- Stop the watchdog timer operation
- Set the low-voltage detection voltage (VLVI) to 4.3 V +-0.2 V
- Generate an internal reset signal (low-voltage detector) when VDD < VLVI
after VDD >= VLVI
- Set the CPU clock to 8 MHz
- Set the clock supplied to the peripheral hardware to 8 MHz
<16-bit timer 00 settings>
- Operation mode: Clear & start the timer count upon a match between TM00
and CR000
- Not performing timer output
- Setting the count clock to the falling edge of the TI000 pin
- Setting the counter compare value to 10
<<I/O port settings>>
Input: P30
Output: P00-P03, P20-P23, P31-P33, P40-P47, P120-P123, P130
# All unused ports are set as the output mode.
32
APPENDIX A PROGRAM LIST
78K0S/KB1+
Sample program
Release
The LED output is reversed by generating an
Application Note U18888EJ1V0AN

Advertisement

Table of Contents
loading

This manual is also suitable for:

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

Table of Contents