Appendix
44
EPE1814V2NAR
Digital I/O Programming Guide
The motherboard provides 8channel programmable digital I/O pins, four of which are
for input while the other four are for output. The following describes digital I/O
program in C language. The steps to program digital I/O are as follows:
Ø
Initialize digital I/O
Ø
I/O programming
(1)
Initialize Digital I/O:
#define
BAR 0x400
unsigned char tmp_val;
outportb(BAR,0xbf);
outportb(BAR+0x04,0x40);
outportb(BAR+0x03,0x03);
outportb(BAR+0x05,0x0F);
tmp_val =(inportb(BAR+0x02)|0x08)&0xeb;
tmp_val |= 0x40;
outportb(BAR+0x02, tmp_val);
delay(30);
tmp_val =inportb(BAR);
while((tmp_val &0x02)!=0x02)
{
tmp_val =inportb(BAR);
if((tmp_val &0x04)!=0)
{
printf("ERROR\n");
return 0;
}
}