Appendix A Program List - NEC 78K0S/K 1+ Series Application Note

Sample program (16-bit timer/event counter 00) interval timer
Hide thumbs Also See for 78K0S/K 1+ Series:
Table of Contents

Advertisement

As a program list example, the 78K0S/KB1+ microcontroller source program is shown below.
main.asm (Assembly language version)
;*****************************************************************************
;
;
NEC Electronics
;
;*****************************************************************************
;
78K0S/KB1+
;*****************************************************************************
;
16-bit timer 00 (interval timer)
;*****************************************************************************
;<<History>>
;
2007.7.--
;*****************************************************************************
;
;<<Overview>>
;
;This sample program presents an example of using the interval timer function
;of 16-bit timer 00.
;through the use of 16-bit timer 00 interrupts.
;changed by rewriting the compare register of the timer when a switch input
;interrupt is generated.
;
;
;
<Principal setting contents>
;
;
- 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
;
- Set the valid edge of external interrupt INTP1 to falling edge
;
- Set the chattering detection time during switch input to 10 ms
;
- Use the HL register for interrupt servicing (similarly as a global
variable)
;
;
;
<16-bit timer 00 settings>
;
- Operation mode: Clear & start the timer count upon a match between TM00
and CR000
;
- Not performing timer output
;
- Count clock = fxp/2^8 (31.25 kHz)
;
- Initial value of timer cycle = About 2 ms (32[us/clk] x 63[count] =
2.016[ms])
;
;
;
<Number of switch inputs and LED blinking cycles>
;
;
+--------------------------+
;
|
SW Inputs | LED Blinking|
;
|
(P43)
;
|------------|-------------|
36

APPENDIX A PROGRAM LIST

78K0S/KB1+
Sample program
Release
The LEDs are blinked by reversing the P20 pin output
| Cycle (P20) |
Application Note U18887EJ1V0AN
The LED blinking cycle is

Advertisement

Table of Contents
loading

This manual is also suitable for:

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

Table of Contents