IBASE IB831 User Manual
Page 25
![background image](https://www.manualsdir.com/files/790354/content/doc025.png)
INSTALLATION
IB831 User’s Manual
21
{
unsigned char ucBuf;
//switch GPIO multi-function pin
Set_W627DHG_LD(0x09);
//switch to logic device 9
//enable the GP2 group
ucBuf = Get_W627DHG_Reg(0x30);
ucBuf |= 0x01;
Set_W627DHG_Reg(0x30, ucBuf);
//input detect type
Set_W627DHG_Reg(0xE5, 0x00);
//no inversion
}
//---------------------------------------------------------------------------
void Dio2SetOutput(unsigned char NewData)
{
//NewData : 1 for input, 0 for output
Set_W627DHG_LD(0x09);
//switch to logic device 9
Set_W627DHG_Reg(0xE4, NewData);
}
//---------------------------------------------------------------------------
unsigned char Dio2GetInput(void)
{
unsigned char result;
Set_W627DHG_LD(0x09);
//switch to logic device 9
result = Get_W627DHG_Reg(0xE4);
return (result);
}
//---------------------------------------------------------------------------
void Dio2SetDirection(unsigned char NewData)
{
//NewData : 1 for input, 0 for output
Set_W627DHG_LD(0x09);
//switch to logic device 9
Set_W627DHG_Reg(0xE3, NewData);
}
//---------------------------------------------------------------------------
unsigned char Dio2GetDirection(void)
{
unsigned char result;
Set_W627DHG_LD(0x09);
//switch to logic device 9
result = Get_W627DHG_Reg(0xE3);
return (result);
}
//---------------------------------------------------------------------------
void Dio3Initial(void)
{
unsigned char ucBuf;
//switch GPIO multi-function pin
ucBuf = Get_W627DHG_Reg(0x2C);
ucBuf &= 0x1F;
Set_W627DHG_Reg(0x2C, ucBuf);
//clear
Set_W627DHG_LD(0x09);
//switch to logic device 9
//enable the GP3 group
ucBuf = Get_W627DHG_Reg(0x30);
ucBuf |= 0x02;
Set_W627DHG_Reg(0x30, ucBuf);
//input detect type
Set_W627DHG_Reg(0xFE, 0xFF);
}
//---------------------------------------------------------------------------
void Dio3SetOutput(unsigned char NewData)
{