Appendix
- 42 -
CPC-1814CLD5NA-N
unsigned int ioadd=(BAR+0x0c);
int
offset=pin_NO/8;
unsigned
char
tempv;
if(pin_NO>=32)
{
ioadd=(BAR+0x38);
offset=(pin_NO-32)/8;
}
while(offset!=0)
{
ioadd++;
offset--;
}
tempv=inportb(ioadd);
if((tempv&ich_mask(1,pin_NO))==0x00)
return 0;
else
return
1;
}
Set the output pin to low level, short circuit the I/O pin, measure the voltage of the
input pin. If the input pin is low level, the IO value is normal; vice versa. Set the
output pin to high level in the same way, short circuit and measure the output pin to
check whether it is high level.