Appendix
EC71817LNAR
47
GPIO Programming Guide
The board provides 8channel programmable digital IO pins, four for input while the
other four for output.
The following provides digital I/O program in C language; please follow the steps
below to implement digital I/O programming:
(The GPIO Input PINs on motherboard include: GP05, GP06, GP46 and GP31; while
the Output PINs include: GP47, GP76, GP36 and GP35)
Ø
Initialize digital I/O
Ø
Input/output program
1.
Initialize digital I/O
#define
INDEX_PORT 0x2E
#define
DATA_PORT
0x2F
VOID PreInitGPIO()
{
outportb(INDEX_PORT,0x87);
outportb(INDEX_PORT,0x87);
outportb(INDEX_PORT,0x07);
outportb(DATA_PORT,0x09);
outportb(INDEX_PORT,0x30);
outportb(DATA_PORT,0x98); // enable GPIO3,4,7.
outportb(INDEX_PORT,0x07);
outportb(DATA_PORT,0x08);
outportb(INDEX_PORT,0x30);
outportb(DATA_PORT,0x02); //enable GPIO0
}
outportb(INDEX_PORT,0x24);
Temp_val=inportb(DATA_PORT)&0xBF;
outportb(DATA_PORT, Temp_val);
//GP05,GP06 select as gpio