S3C9228/P9228

I/O PORTS

 

 

PORT 2

Port 2 is an 4-bit I/O port with individually configurable pins. Port 2 pins are accessed directly by writing or reading the port 2 data register, P2 at location E6H in page 0. P2.0-P2.3 can serve as inputs (with or without pull- up), as outputs (push-pull or open-drain) or you can be configured the following functions.

Low-nibble pins (P2.0-P2.3): SCK, SO, SI, SEG0-SEG1

Port 2 Control Register (P2CON)

Port 2 has a 8-bit control register: P2CON for P2.0-P2.3. A reset clears the P2CON register to "00H", configuring pins to input mode. You use control register setting to select input or output mode (push-pull or open-drain) and enable the alternative functions.

When programming this port, please remember that any alternative peripheral I/O function you configure using the port 2 control register must also be enabled in the associated peripheral module.

Port 2 Pull-up Resistor Control Register (P2PUR)

Using the port 2 pull-up resistor control register, P2PUR (F4H, page 0), you can configure pull-up resistors to individual port 2 pins.

Port 2 Control Register (P2CON)

F3H, Page 0, R/W

MSB

.7

.6

.5

.4

.3

.2

.1

.0 LSB

P2.3 P2.2/SI P2.1/SO/SEG0 P2.0/SCK/SEG1

P2CON bit-pair pin configuration settings:

00

01

10

11

Schmitt trigger input mode (SI,SCK) Push-pull output mode N-channel open-drain output mode

Alternative function (SCK, SO)

Figure 9-12. Port 2 Control Register (P2CON)

9-9

Page 389
Image 389
Samsung 8-Bit CMOS Microcontroller, S3C9228/P9228 user manual Port