
Appendix
- 42 -
104-1649CLD2NA Series
{
tmp_val
=inportb(BAR);
if((tmp_val
&0x04)!=0)
{
printf("ERROR\n");
return 0;
}
}
(2)
Input/Output Program:
a.
Output Program
Function Input: int pin – values 1~4 are corresponding with the output pins 1~4
respectively
int lev_val – 1: the output pin is high, 0: the output pin is low
Function Output: None
void Out_Lev(int pin ,int lev_val)
{
unsigned int reg_val ;
outportb(BAR,0xbf);
outportb(BAR+0x04,0x40);
outportb(BAR+0x03,0x01);
reg_val = inportb(BAR+0x05);
reg_val = lev_val ?
reg_val|(0x01<<(pin+3)) :reg_val&(~(0x01<<(pin+3))) ;
outportb(BAR+0x05, reg_val);