CY8C28xxx PSoC Programmable System-on-Chip TRM, Document No. 001-52594 Rev. *G
73
6. General Purpose I/O (GPIO)
This chapter discusses the General Purpose I/O (GPIO) and its associated registers, which is the circuit responsible for inter-
facing to the I/O pins of a PSoC
®
device. The GPIO blocks provide the interface between the M8C core and the outside world.
They offer a large number of configurations to support several types of
operations for both digital and ana-
log systems. For a complete table of the GPIO registers, refer to the
“Summary Table of the Core Registers” on page 36
a quick reference of all PSoC registers in address order, refer to the
Register Details chapter on page 125
.
6.1
Architectural Description
The GPIO contains input buffers, output drivers, register bit
storage, and configuration logic for connecting the PSoC
device to the outside world.
I/O Ports are arranged with (up to) 8 bits per port. Each full
port contains eight identical GPIO blocks, with connections
to identify a unique address and register bit number for each
block. Each GPIO block can be used for the following types
of I/O:
■
Digital I/O (digital input and output controlled by soft-
ware)
■
Global I/O (digital PSoC block input and output)
■
Analog I/O (analog PSoC block input and output)
Each I/O pin also has several drive modes, as well as inter-
rupt capabilities. While all GPIO pins are identical and pro-
vide digital I/O, some pins may not connect internally to
analog functions.
The main block diagram for the GPIO block is shown in
. Note that some pins do not have all of the func-
tionality shown, depending on internal connections.
The CY8C28x13, CY8C28x33, CY8C28x43, CY8C28x45,
and CY8C28x52 PSoC devices contain an enhanced capa-
bility to connect any GPIO to an internal analog bus. This is
described in detail in the
I/O Analog Multiplexer chapter on
6.1.1
Digital I/O
One of the basic operations of the GPIO ports is to allow the
M8C to send information out of the PSoC device and get
information into the M8C from outside the PSoC device.
This is accomplished by way of the port data register
(PRTxDR). Writes from the M8C to the PRTxDR register
store the data state, one bit per GPIO. In the standard non-
bypass mode, the pin drivers drive the pin in response to
this data bit, with a drive strength determined by the Drive
mode setting (see
). The actual voltage on the pin
depends on the Drive mode and the external
.
The M8C can read the value of a port by reading the
PRTxDR register address. When the M8C reads the
PRTxDR register address, the current value of the pin volt-
age is translated into a logic value and returned to the M8C.
Note that the pin voltage can represent a different logic
value than the last value written to the PRTxDR register.
This is an important distinction to remember in situations
such as the use of a read modify write to a PRTxDR register.
Examples of read modify write instructions include
, and
The following is an example of how a read modify write, to a
PRTxDR register, can have an unexpected and even inde-
terminate result in certain systems. Consider a scenario
where all bits of Port 1 on the PSoC device are in the strong
1 resistive 0 drive mode; so that in some cases, the system
the PSoC is in may pull up one of the bits.
mov
reg[PRT1DR], 0x00
or
reg[PRT1DR], 0x80
In the first line of code above, writing a 0x00 to the port will
not affect any bits that happen to be driven by the system
the PSoC is in. However, in the second line of code, it can
not guarantee that only bit 7 will be the one set to a strong 1.
Because the OR instruction will first read the port, any bits
that are in the pull up state will be read as a ‘1’. These ones
will then be written back to the port. When this happens, the
pin will go in to a strong 1 state; therefore, if the pull up con-
dition ends in the system, the PSoC will keep the pin value
at a logic 1.
6.1.2
Global I/O
The GPIO ports are also used to interconnect signals to and
from the digital PSoC blocks, as global inputs or outputs.
Summary of Contents for CY8C28 series
Page 65: ...64 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G RAM Paging ...
Page 125: ...124 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Page 311: ...310 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G IDAC_CR0 1 FDh ...
Page 317: ...316 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Page 393: ...392 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...
Page 477: ...476 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G Digital Clocks ...
Page 561: ...560 CY8C28xxx PSoC Programmable System on Chip TRM Document No 001 52594 Rev G ...