System Installation
WADE-8044 User’s Manual
3-7
3.5.3 Example1
There are 8 GPIO pins in this board and users can set any GPIO pin as Input or
Output. The GPIO Pin SB_GP33 Which SB stands for Source Bridge and GPIO pin
W_GP36 which W stands for Super I/O. Below we show how to set GPIO pin as
Input/Output.
How to setup GPIO Behavior
Predefine I/O address to configure Super I/O and Source Bridge GPIO pins.
#define IOADDRESS
0x2E //Super IO Configuration I/O Port
#define IODATA
0x2F
#define GPIOBASE
0x480 //GPIO base address for Source Bridge
Initial SB_GP27 ,where parameter Mode=0 set as Output, Mode=1 set as Input.
void InitSB_GPIO27(int Mode)
{
unsigned char TempData;
/* Set GPIO27 as GPIO pin */
TempData = inportb(G3);
TempData |= 0x08;
outportb(G3, TempData);
TempData = inportb(G7);
switch(Mode)
{
case 0: /* output */
TempData &= ~(0x08); /* bit 27 */
break;
case 1: /* input */
TempData |= 0x08; /* bit 27 */
break;
}/* switch(mode) */
outportb(G7, TempData);
}
Read SB_GP27
unsigned char RDSB_GPIO27()
{
unsigned char TempData;
TempData = inportb(G0x0F) & 0x08;
return TempData;
}