System Installation
WADE-8022 User’s Manual
3-6
3.6 EC
GPIO
Sample code:
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <dos.h>
#define EC_DATA 0x62
#define EC_CMD 0x66
#define EC_CMD_READ 0x80
#define EC_CMD_WRITE 0x81
#define GPIO_DIR 0x2B
#define GPIO_DATA 0x2C
static void Write_EC (unsigned char index, unsigned char data)
{
sleep(1);
outportb (EC_CMD, EC_CMD_WRITE);
sleep(1);
outportb (EC_DATA, index);
sleep(1);
outportb
(EC_DATA,
data);
}
static unsigned char Read_EC (unsigned char address)
{
unsigned char data;
sleep(1);
outportb (EC_CMD, EC_CMD_READ);
sleep(1);
outportb
(EC_DATA,
address);
sleep(1);
data = inportb (EC_DATA);
return
data;
}
int main ()
{
unsigned char d2;
printf("\n\n");
printf("WADE-8079 GPIO TEST Program v1.0\n");
printf("Please short the following pins with 2.54mm-pitched jumper on
JP8\n");