Vortex86DX-MSJK CE 6.0 Jump Start - Getting Started Guide
Vortex86DX-MSJK Windows Embedded CE 6.0 R3 Jump Start Rev 2.0
Page 140
Configure GPIO to Intput Mode
When configured to input mode, the GPIO can be used to detect the status of a push button,
relay, or another device with appropriate electronic circuitry.
Each of the 8-bits on Port-0 and Port-1 can be configured independently to input or output
mode, by writing the appropriate value to the direction register at 98H for Port-0 and 99H for
Port-1, as follow:
To configure all 8-bits on Port-0 to output mode:
Outportb(0x98, 0x00);
To configure all 8-bits on Port-1 to output mode:
Outportb(0x99, 0x00);
Note:
There is one configuration bit to configure the GPIO bit to either input or output mode. If the GPIO bit is
not configured to “input” mode, it’s in “output” mode.
When configured to output mode, the GPIO bit measures 2.45V.
After the GPIO bit is configured to input mode, it measures 2.45V with associated data bit set to
“1”.
When a GPIO bit, configured to input mode, is grounded, the associated data bit is changed to
“0”. After the GPIO bit is disconnected from the grounding signal, the associated data bit
changes back to “1”.
To capture the status of a GPIO bit configured to input mode, you need write a routine to poll
the associated data bit for changes.
To read data associated with GPIO bits configured to input mode, use the inportb() function to
read data from 78H for Port-0 and 79H for Port-1, as follow:
To read data on Port-0:
inportb(0x78);
To read data on Port-1:
inportb(0x79);
GPIO.DLL
The GPIO.DLL is provided to help managed code developer to access and use the GPIO. The
GPIO.DLL is provided as part of the BSP and include in resulting CE 6.0 OS runtime image when this
BSP is in used to develop the OS design.
The GPIO.DLL exposes the following API to configure GPIO input/output mode, set individual GPIO
bit high or low and read GPIO data:
•
SetPort0Dir(byte dbDirection)
Function to set GPIO Port-0 to input or output mode
•
SetPort1Dir(byte dbDirection)
Function to set GPIO Port-1 to input or output mode
•
SetPort2Dir(byte dbDirection)
Function to set GPIO Port-2 to input or output mode