System Installation
WADE-8041 User’s Manual
3-10
if (d2 == 0xEE )
printf("\n GPIO14->10 test ok");
else
printf("\n GPIO14->10 test fail ");
----------------------------------------------------------------------------------------------------------------
* Remarks
General Purpose Input/Output Interface (refer to J22)
a. Function description
IOGP10~IOGP17 belong to CMOS level Schmitt-trigger bi-directional pin with pull
up resistor and open-drain output with 12mA sink capability.
b. Process
1. Setup function as GPIO Pin
2. Input Voltage to Input Port
3. Read Output Port value
c. Example Program
Use “Turbo C” program Setup
#include <stdio.h>
#include <dos.h>
int main(void)
{
int x,outdata,indata;
printf("Now output data to GPIO Port ...");
// Enter the extended function mode
outport(0x2e,0x87);
outport(0x2e,0x87);
// GPIO multiplexed pin selection
outport(0x2e,0x2a);
outport(0x2f,0xff);
//GP10 - GP14 enable
// Enable GPIO port1
outport(0x2e,0x30);
outport(0x2f,0xff);
//Enable GPIO function
// Select the logical device
outport(0x2e,0x07);
outport(0x2f,0x07);
// Device 7