HAN Pilot Platform
Demonstration Manual
45
www.terasic.com
September 6, 2019
GPIO2 controller.
Figure 3-2 Block diagram of GPIO Interface
GPIO Register Block
The behavior of I/O pin is controlled by the registers in the register block. There are three 32-bit
registers in the GPIO controller used in this demonstration. The registers are:
gpio_swporta_dr
: write output data to output I/O pin
gpio_swporta_ddr
: configure the direction of I/O pin
gpio_ext_porta
: read input data of I/O input pin
The
gpio_swporta_ddr
configures the LED pin as output pin and drives it high or low by writing
data to the
gpio_swporta_dr
register. The first bit (least significant bit) of
gpio_swporta_ddr
controls the direction of first IO pin in the associated GPIO controller and the second bit controls
the direction of second IO pin in the associated GPIO controller and so on. The value "1" in the
register bit indicates the I/O direction is output, and the value "0" in the register bit indicates the I/O
direction is input.
The first bit of
gpio_swporta_dr
register controls the output value of first I/O pin in the associated
GPIO controller, and the second bit controls the output value of second I/O pin in the associated
GPIO controller and so on. The value "1" in the register bit indicates the output value is high, and
the value "0" indicates the output value is low.
The status of KEY can be queried by reading the value of
gpio_ext_porta
register. The first bit
represents the input status of first IO pin in the associated GPIO controller, and the second bit
represents the input status of second IO pin in the associated GPIO controller and so on. The value
"1" in the register bit indicates the input state is high, and the value "0" indicates the input state is
low.
Содержание HAN Pilot Platform
Страница 1: ......
Страница 92: ...HAN Pilot Platform Demonstration Manual 91 www terasic com September 6 2019...