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

Led lighting switch control sample program (initial settings)
Hide thumbs Also See for 78K0S/K 1+ Series:
Table of Contents

Advertisement

(3) Setting the connection of internal pull-up resistors to input ports
The PUxx registers are used to set whether internal pull-up resistors are to be connected to the input ports.
Internal pull-up resistors are not connected after reset release.
The PUxx format is described, taking the PU2 register as an example.
In this sample program, port 4 is set as described in
PU2
0
0
0
Caution Bits 7 to 4 must be set to 0.
[Example 1] • Setting P20 to P23 as output ports
• Setting the P20 to P22 output latches to high-level output, setting the P23 output latch to low-level
output (Same as in the sample program setting)
PM2
1
1
1
P2
0
0
0
The PM2 register setting value is
is
"00000111
(bits 7 to 4 must be set to 0)".
• Assembly language
MOV
PM2, #11110000B
MOV
P2,
• C language
PM2 = 0b11110000;
P2 = 0b00000111;
24
CHAPTER 4 SETTING METHODS
Figure 4-8. Format of Pull-up Resistor Option Register 2 (PU2)
0
PU23
PU22
PU21
1
0
0
0
0
0
1
1
"11110000
#00000111B
Application Note U18752EJ2V0AN
[Example
2], mentioned later.
PU20
Selection of the P2n (n = 0 to 3) pin internal pull-up resistor
0
Internal pull-up resistor is not connected.
1
Internal pull-up resistor is connected.
0
Selection of the P2n (n = 0 to 3) pin I/O mode
0
Output mode
* In this sample program, P20 to P22 are used as output
ports for lighting LEDs, so port 2 is set as an output port.
1
Selection of the P20 to P22 pin output latch levels
1
High-level output
Selection of the P23 pin output latch level
0
Low-level output
* In this sample program, P20 to P22 are used as output ports
for lighting LEDs, so the P20 to P22 output latch levels are
set to high-level output in the initial settings.
(LEDs are lit when the outputs from P20 to P22 are at low
level (refer to
2.1 Circuit
(bits 7 to 4 must be set to 1)", and the P2 register setting value
Diagram).)

Advertisement

Table of Contents
loading

This manual is also suitable for:

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

Table of Contents