I/O PORTS KS57C2308/P2308/C2316/P2316
10-4
++ PROGRAMMING TIP — Enabling and Disabling I/O Port Pull-Up Resistors
P2 and P3 are enabled to be pull-up resistors.
BITS EMB
SMB 15
LD EA,#0CH
LD PUMOD,EA ;enable the pull-up resistors of P2 and P3
N-CHANNEL OPEN-DRAIN MODE REGISTER (PNE)
The n-channel open-drain mode register (PNE) is used to configure ports 4 and 5 to n-channel open-drain or as
push-pull outputs. When a bit in the PNE register is set to "1", the corresponding output pin is configured to
n-channel, open-drain; when set to "0", the output pin is configured to push-pull. The PNE register consists of an
8-bit register, PNE can be addressed by 8-bit write instructions only.
FD6HPNE4.3 PNE4.2 PNE4.1 PNE4.0
FD7HPNE5.3 PNE5.2 PNE5.1 PNE5.0
PIN ADDRESSING FOR OUTPUT PORT 8
The addresses for the port 8 1-bit output pin buffers are located in bank 1 of data memory instead of bank 15. To
address port 8 output pins, use the settings EMB = 1 and SMB = 1. The LCD mode register, LMOD is used to
control whether the pin address is used for LCD data output or for normal data output:
Table 10-5. LMOD.7 and LMOD.6 Setting for Port 8 Output Control
LMOD.7 LMOD.6 LCD Output Segments 1-Bit Output Pins
0 0 Seg 24–31
0 1 Seg 24–27 P8.4–P8.7 (Seg 28–31)
1 0 Seg 28–31 P8.0–P8.3 (Seg 24–27)
1 1 P8.0–P8.7 (Seg 24–31)
Each address in RAM bank 1 corresponds to a 4-bit register location. The LSB (bit 0) of the register location is
used as the port buffer for either LCD segment output or normal 1-bit data output. Locations that are unused for
LCD or port I/O can be used as normal data memory. After a RESET, the values contained in the port 8 output
buffer are left undetermined.
Table 10-6 shows port 8 pin addresses and also the corresponding LCD segment names if the pins are used to
output LCD segment data. Pin addresses that are not used for LCD segment output can be used for normal 1-bit
output.