Appendix
CPC-1814CLD5NA-N
- 39 -
ioadd++;
offset--;
}
mask=ich_mask(1,pin_NO);
tempv=inportb(ioadd)|mask;
outportb(ioadd,tempv);
}
/*************************************************************
Function Name: set_in_out(int in_out,int pin_NO)
Input Parameters: (in/out, PIN number)(in_out=1 input,=0 output)
Returned Value:
Functions: initialize GPIO according to DATASHEET specification
*************************************************************/
void set_in_out(const int in_out, const int pin_NO)
{
//the calculation of the function is the same as that of initializ_gpio(int pin_NO)
unsigned int ioadd=(BAR+0x04);
unsigned
char
mask;
int
offset=pin_NO/8;
unsigned
char
tempv;
if(pin_NO>31)
{
ioadd=(BAR+0x34);
offset=(pin_NO-32)/8;
}
while(offset!=0)
{
ioadd++;
offset--;
}