English
Language : 

SH7764 Datasheet, PDF (1466/1752 Pages) Renesas Technology Corp – Renesas 32-Bit RISC Microcomputer SuperHTM RISC Engine Family SH-4A Series
Section 27 General Purpose I/O (GPIO)
27.3 Usage Examples
The following describes examples of GPIO setting procedures.
27.3.1 Port Function Select
Before selecting the port function, be sure to select the port output or input function as described
later. Then, select the port function through the corresponding pin select register (PTSEL_A to
PTSEL_J).
Note that an error such as a signal conflict will occur if the port function is selected through the
pin select register while the input/output setting for the port is wrong.
27.3.2 Port Output Function
To select the port output function for a pin, write B'01 to the corresponding two bits in the port
control register (PTIO_A to PTIO_J); the data in the corresponding bit in the port data register
(PTDAT_A to PTDAT_J) is output from the port.
When the port output function is selected for a pin, the setting in the pull-up control register
(PTPUL_AB to PTUPL_IJ) for the pin is ignored.
27.3.3 Port Input Function
To select the port input function for a pin, write B'10 to the corresponding two bits in the port
control register (PTIO_A to PTIO_J) when turning off the pull-up MOS or B'11 when turning on
the pull-up MOS; the data input through the pin can be read from the corresponding bit in the port
data register (PTDAT_A to PTDAT_J).
27.3.4 On-Chip Module Function
To select the on-chip module function, first select the on-chip module to be used through the pin
select register (PTSEL_A to PTSEL_J).
Then, write B'00 to the corresponding two bits in the port control register (PTIO_A to PTIO_J).
Rev. 1.00 Nov. 22, 2007 Page 1410 of 1692
REJ09B0360-0100