User Manual

GPIO
38

Digi Connect EM & Wi-EM Hardware Reference
GPIO Registers
Two registers, PORTA and PORTC, govern the 16 GPIO pins. Each is responsible for eight
GPIO pins, and each pin has four bits that completely describe its behavior. The four bits
that describe the GPIO behavior are its mode (CMODE), direction (CDIR), special
function (CSF--only applicable to PORTC), and data value. The first three bits describe the
functionality of the GPIO pin. The "data" bit provides the current value of the pin when
read and allows control of the value of an output pin when written. Use the following table
for information on configuring a bit position in the appropriate register for GPIO input or
output.
Since each register controls 8 GPIO lines, it is safest to read the full 32 bit register, modify
the bits corresponding to the GPIO line of interest, and then write the full 32 bits back. In
this way, the behavior of the other GPIO lines will be preserved.
For more information regarding the format and programming of the GPIO registers, see the
NS7520 Hardware Reference.
Configuring a GPIO Pin for Input and Output
Input Output

CMODE = 0

CDIR = 0

CSF = 0

CMODE = 0

CDIR = 1

CSF = 0