Texas Instruments TMS320C645x manual Gpio Function

Models: TMS320C645x

1 27
Download 27 pages 54.69 Kb
Page 12
Image 12

GPIO Function

2 GPIO Function

You can independently configure each GPIO pin (GPn) as either an input or an output using the GPIO direction registers. The GPIO direction register (DIR) specifies the direction of each GPIO signal. Logic 0 indicates the GPIO pin is configured as output, and logic 1 indicates input.

When configured as output, writing a 1 to a bit in the set data register drives the corresponding GPn to a logic-high state. Writing a 1 to a bit in the clear data register drives the corresponding GPn to a logic-low state. The output state of each GPn can also be directly controlled by writing to the output data register. For example, to set GP8 to a logic-high state, the software can perform one of the following:

-Write 0x100 to the SET_DATA register

-Read in OUT_DATA register, change the eighth bit to 1, and write the new value back to OUT_DATA

To set GP8 to a logic-low state, the software can perform one of the following:

-Write 0x100 to the CLR_DATA register

-Read in OUT_DATA register, change the eighth bit to 0, and write the new value back to OUT_DATA

Note that writing a 0 to bits in the set data and clear data registers does not affect the GPIO pin state. Also, for GPIO pins configured as input, writing to the set data, clear data, or output data registers does not affect the pin state.

For a GPIO pin configured as input, reading the input data register (IN_DATA) will return the pin state.

Reading the SET_DATA register or the CLR_DATA data register will return the value in OUT_DATA, not the actual pin state. The pin state is available by reading the input data register.

12

General-Purpose Input/Output (GPIO)

SPRU724

Page 12
Image 12
Texas Instruments TMS320C645x manual Gpio Function