MB95710M Series
MB95770M Series
Document Number: 002-09307 Rev. *D
Page 78 of 172
18.9.3 Port B registers
• Port B register functions
• Correspondence between registers and pins for port B
18.9.4 Port B operations
• Operation as an output port
• A pin becomes an output port if the bit in the DDRB register corresponding to that pin is set to “1”.
• For a pin shared with other peripheral functions, disable the output of such peripheral functions.
• When a pin is used as an output port, it outputs the value of the PDRB register to external pins.
• If data is written to the PDRB register, the value is stored in the output latch and is output to the pin set as an output
port as it is.
• Reading the PDRB register returns the PDRB register value.
• To use a pin shared with the LCDC as an output port, set a corresponding function select bit in the LCDC enable
register 3 (LCDCE3:SEG[01:00]) or in the LCDC enable register 7 (LCDCE7:SEG[39:37]) to “0” to select the gen-
eral-purpose I/O port function, and then set the port input control bit (PICTL) in the LCDC enable register 1 (LC-
DCE1) to “1”.
• Operation as an input port
• A pin becomes an input port if the bit in the DDRB register corresponding to that pin is set to “0”.
• For a pin shared with other peripheral functions, disable the output of such peripheral functions.
• If data is written to the PDRB register, the value is stored in the output latch but is not output to the pin set as an
input port.
• Reading the PDRB register returns the pin value. However, if the read-modify-write (RMW) type of instruction is
used to read the PDRB register, the PDRB register value is returned.
• To use a pin shared with the LCDC as an input port, set a corresponding function select bit in the LCDC enable
register 3 (LCDCE3:SEG[01:00]) or in the LCDC enable register 7 (LCDCE7:SEG[39:37]) to “0” to select the gen-
eral-purpose I/O port function, and then set the PICTL bit in the LCDCE1 register to “1”.
• Operation as an LCDC segment output pin
• Set the bit in the DDRB register corresponding to an LCDC segment output pin to “0”.
• To use a pin shared with a general-purpose I/O port as an LCDC segment output pin, set a corresponding function
select bit in the LCDC enable register 3 (LCDCE3:SEG[01:00]) or in the LCDC enable register 7 (LC-
DCE7:SEG[39:37]) to “1” to select the LCDC segment output function, and then set the PICTL bit in the LCDCE1
register to “1”.
Register
abbreviation
Data
Read
Read by read-modify-write
(RMW) instruction
Write
PDRB
0
Pin state is “L” level.
PDRB value is “0”.
As output port, outputs “L” level.
1
Pin state is “H” level.
PDRB value is “1”.
As output port, outputs “H” level.
DDRB
0
Port input enabled
1
Port output enabled
Correspondence between related register bits and pins
Pin name
-
-
-
PB4
PB3
PB2
PB1
PB0
PDRB
-
-
-
bit4
bit3
bit2
bit1
bit0
DDRB