System Installation
NANO-5050 User’s Manual
3-6
outportb(0x2E, 0x87);
outportb(0x2E, 0x87);
}
void exit_SIO ()
{
outportb(0x2E, 0xAA);
}
void change_LDN (unsigned char LDN)
{
outportb (0x2E, 0x07);
outportb (0x2F, LDN);
}
unsigned char get_CFG (unsigned char Add)
{
outportb (0x2E, Add);
return inportb (0x2F);
}
void set_CFG (unsigned char Add, unsigned char Value)
{
outportb (0x2E, Add);
outportb (0x2F, Value);
}
void main (void)
{
unsigned char tmpData = 0x0;
printf("==== NANO-5050 GPIO test program ====\n");
enter_SIO();
// Initialze GPIO function
set_cfg (0x2C, get_cfg (0x2C) & ~0xE0; );
// Switch to LDN9 for GPIO3
change_LDN(0x09);
// Enable GPIO3 function
set_CFG (0x30, (get_CFG (0x30) | 0x02));
set_CFG (0xF9, 0x00);
set_CFG (0xFE, 0x70);
// printf("Set GP1~4 to INPUT, GP5~8 to OUTPUT\n");
set_CFG (0xF0, 0xF0);
// printf("Set GP5~8 HIGH\n");