Appendix
52
EC71813CLD2NA SERIES
outportb(BAR,0xbf);
if(pin < 5)
{
outportb(BAR+0x04,0x41);
pin = pin +4;
}
else
{
outportb(BAR+0x04,0x43);
}
outportb(BAR+0x03,0x00);
reg_val =(inportb(BAR+0x02)|0x08)&0xeb;
reg_val |= 0x40;
outportb(BAR+0x02, reg_val);
delay(30);
reg_val =inportb(BAR);
while((reg_val &0x02)!=0x02)
{
reg_val =inportb(BAR);
if((reg_val &0x04)!=0)
{
printf("ERROR\n");
return 0;
}
}
lev_val = inportb(BAR+0x05)&( 0x01<<pin1);
lev_val = lev_val ? 1:0; /*Get the variable lev_val, 1 represents that
the input pin is high level, while 0 represents the input pin is low
level*/
return lev_val ;
}