A.1 program gpio function to output, Program gpio function to output – ADLINK AmITX-IB-I User Manual

Page 68

Advertising
background image

56

Super IO Programming Guide

A.1 Program GPIO Function to Output

// before SIO programming, must enter config mode. //

SIOEnterConfig(); Enter SIO configure mode.

// bIndex = 07h as logical device selection register.

// bValue = 07h as logical device number (QM67 uses

GPIO 6)

SIOWrite(0x07, 0x07); Select to Logical Device 7

// bIndex = F4h as control register

// bValue = 00h as output enabled.

SIOWrite(0xF4, 0x00); Set all GPI/O to output.

GPIO Function to AllOutput High

// bIndex = F5h as output register

// bValue = FFh as output level high

SIOWrite(0xF4, 0x00); set all GPI/O to output.

GPIO function to All Output Low

// bIndex = F5h as output register

// bValue = 00h as output level high

SIOWrite(0xF5, 0x00); set all GPI/O to output.

GPIO function to Output High (GPIOx)

// bIndex = F5h as output register

bValue = SIORead(0xF5); read back output register

bValue |= 1 << x; x means GPIO number.

SIOWrite(0xF5, bValue); set GPI/Ox to output high.

GPIO function to Output Low (GPIOx)

// bIndex = F5h as output register

bValue = SIORead(0xF5); read back output register

bValue &= ~(1 << x); x means GPIO number

SIOWrite(0xF5, bValue); set GPI/Ox to output low.

// after SIO programming, must exit config mode. //

SIOExitConfig(); Exit SIO configure mode.

Advertising