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

Led lighting switch control sample program (initial settings)
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+
;*******************************************************************************
;
Initialization
;*******************************************************************************
;<<History>>
;
2007.4.--
;*******************************************************************************
;
;<<Overview>>
;
; This sample program initializes the microcontroller by setting functions
; such as clock frequency and the port to the input or output.
; After the initialization, three LED lights are controlled by two switches.
;
; <Principal setting contents in initialization>
;
; - Set the vector table
; - Set the stack pointer
; - Stop the watchdog timer operation
; - Set the CPU clock frequency at 2 MHz
; - Stop the low-speed internal oscillator
; - Set the ports to the input or output mode
; - Set the connection of on-chip pull-up resistors (input port only)
; - Set the output latches of the output ports
;
;
; <Switch input and LED output>
;
;
+---------------------------------------+
;
|
SW1
|
SW2
;
| (P40) | (P43) | (P20) | (P21) | (P22) |
;
|---------------|-----------------------|
;
|
OFF
|
OFF
;
|
ON
|
OFF
;
|
OFF
|
ON
;
|
ON
|
ON
;
+---------------------------------------+
;
;
;<<I/O port settings>>
;
;
Input:
P40, P43
;
Output: P00-P03, P20-P23, P30-P33, P41, P42, P44-P47, P120-P123, P130
;
# All unused ports are set as the output mode.
;
;*******************************************************************************
36

APPENDIX A PROGRAM LIST

78K0S/KB1+
Sample program
Release
|
LED1 |
LED2 |
|
OFF
|
OFF
|
|
ON
|
OFF
|
|
OFF
|
ON
|
|
OFF
|
OFF
|
Application Note U18752EJ2V0AN
LED3 |
OFF
|
OFF
|
OFF
|
ON
|

Advertisement

Table of Contents
loading

This manual is also suitable for:

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

Table of Contents