Appendix A
71
BEM-100F series User’s Manual
{
int
GPIOBASE
=
0xA04;
int
RetVal;
int
i;
int
Temp;
//Set DIO_0~7 as Input
//0:input 1:output
Set_SIO_LD(0x07);
RetVal = Get_SIO_Reg(0xCC);
RetVal
&=
0x00;
Set_SIO_Reg(0xCC,
RetVal);
//Read DIO_0~7 value
RetVal = inportb(GPIOBASE);
printf("Read DIO_0~7 value\n");
for (i=0; i<8; i++)
{
Temp = (RetVal>>i) & 0x01;
printf("DIO_%d = %d\n",i ,Temp);
}
system("pause");
//Set DIO_0~7 as Output
//0:input 1:output
Set_SIO_LD(0x07);
RetVal = Get_SIO_Reg(0xCC);
RetVal
|=
0xFF;
Set_SIO_Reg(0xCC,
RetVal);
//set DIO_0~7 to High
printf("Set DIO_0~7 to High\n");
outportb(GPIOBASE,
0xFF);
system("pause");
//set DIO_0~7 to Low
printf("Set DIO_0~7 to Low\n");