Aplex Technology AHM-6086A User Manual
Page 57
Advertising

AHM-6XX6A User Manual
56
The followings are C language source code:
#include "stdio.h"
#include "conio.h"
//Super I/O index access port
#define INDEXP 0x4E
#define DATAP 0x4F
//Enter super I/O programming mode
#define ENTERPRG { \
outportb(INDEXP, 0x87); \
outportb(INDEXP, 0x87);}
//Super I/O index write
#define WRITEREG(reg,val) { \
outportb(INDEXP, reg); \
outportb(DATAP, val);}
//Exit super I/O programming mode
#define EXITPRG { \
outportb(INDEXP, 0xAA);}
//Select logic device number
#define SELETDEV(ldn) { \
outportb(INDEXP, 7); \
outportb(DATAP, ldn); }
//Initialize the GPIO port2
int InitGP2() {
//Start the super I/O chip programming
ENTERPRG
//Select the logical device 9, GP2
SELETDEV(9)
//Activate GP1
Advertising