Appendix
EC71813CLD2NA SERIES
51
outportb(BAR+0x04,0x42);
pin = pin – 4;
}
outportb(BAR+0x03,0x01);
reg_val = inportb(BAR+0x05);
reg_val = lev_val ?
reg_val|(0x01<<pin1) :reg_val&(~(0x01<<pin1)) ;
outportb(BAR+0x05, reg_val);
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;
}
}
}
b.
Input Program
Functions Input: int pin Value 1 ~ 8 are corresponding with the input pin 1 ~ 8
Functions Output: int lev_val 1: the input pin is high level; 0: the input pin is low
level
int In_Lev(int pin)
{
unsigned int reg_val ;
int lev_val ;