10.3.1.1
Data Direction Operation
The
GPIO Direction (GPIODIR)
register (see page 760) is used to configure each individual pin as
an input or output. When the data direction bit is cleared, the GPIO is configured as an input, and
the corresponding data register bit captures and stores the value on the GPIO port. When the data
direction bit is set, the GPIO is configured as an output, and the corresponding data register bit is
driven out on the GPIO port.
10.3.1.2
Data Register Operation
To aid in the efficiency of software, the GPIO ports allow for the modification of individual bits in the
GPIO Data (GPIODATA)
register (see page 759) by using bits [9:2] of the address bus as a mask.
In this manner, software drivers can modify individual GPIO pins in a single instruction without
affecting the state of the other pins. This method is more efficient than the conventional method of
performing a read-modify-write operation to set or clear an individual GPIO pin. To implement this
feature, the
GPIODATA
register covers 256 locations in the memory map.
During a write, if the address bit associated with that data bit is set, the value of the
GPIODATA
register is altered. If the address bit is cleared, the data bit is left unchanged.
For example, writing a value of 0xEB to the address GP 0x098 has the results shown in
Figure 10-3, where
u
indicates that data is unchanged by the write. This example demonstrates
how
GPIODATA
bits 5, 2, and 1 are written.
Figure 10-3. GPIODATA Write Example
0
1
0
0
1
1
0
0
0
u
1
u
u
0
1
u
u
9
8
7
6
5
4
3
2
1
0
1
1
1
0
0
1
1
1
7
6
5
4
3
2
1
0
GPIODATA
0xEB
0x098
ADDR[9:2]
0
During a read, if the address bit associated with the data bit is set, the value is read. If the address
bit associated with the data bit is cleared, the data bit is read as a zero, regardless of its actual
value. For example, reading address GP 0x0C4 yields as shown in Figure 10-4. This
example shows how to read
GPIODATA
bits 5, 4, and 0.
Figure 10-4. GPIODATA Read Example
0
1
0
1
0
0
0
1
0
0
0
1
0
1
0
0
0
0
9
8
7
6
5
4
3
2
1
0
0
1
1
1
1
1
1
0
7
6
5
4
3
2
1
0
Returned Value
GPIODATA
0x0C4
ADDR[9:2]
749
June 18, 2014
Texas Instruments-Production Data
Tiva
™
TM4C1294NCPDT Microcontroller