beautypg.com

Appendix 54, Mi802 user’s manual – IBASE MI802 User Manual

Page 58

background image

APPENDIX

54

MI802 User’s Manual



Dio3SetOutput(0x00);

//clear

DIO = Dio3GetInput() & 0x0F;

if (DIO != 0x0A)

{

printf("The Fintek 81866 digital IO abnormal, abort.\n");

return(1);

}//if (DIO != 0x0A)


Dio3SetOutput(0xA0);

//clr# is high

Dio3SetOutput(0xF0);

//clk and clr# is high

Dio3SetOutput(0xA0);

//clr# is high


DIO = Dio3GetInput() & 0x0F;

if (DIO != 0x05)

{

printf("The Fintek 81866 digital IO abnormal, abort.\n");

return(1);

}

printf("!!! Pass !!!\n");

return 0;

}
//---------------------------------------------------------------------------
void Dio3Initial(void)
{

unsigned char ucBuf;


// Switch GPIO multi-function pin for gpio 30~37

// Multi Pin Select UART2/GPIOs

// bit[6:5] 0:UART2 / 1:GPIOs


ucBuf = Get_F81866_Reg(0x28);

ucBuf |= BIT5;

Set_F81866_Reg(0x28, ucBuf);


Set_F81866_LD(0x06);

//switch to logic device 6


//enable the GP3 group

ucBuf = Get_F81866_Reg(0x30);

ucBuf |= 0x01;

Set_F81866_Reg(0x30, ucBuf);


Set_F81866_Reg(0x88, 0x00);

//define as input mode

//Set_F81866_Reg(0xA3, 0xFF);

//push pull mode

}
//---------------------------------------------------------------------------
void Dio3SetOutput(unsigned char NewData)
{

Set_F81866_LD(0x06);

//switch to logic device 6

Set_F81866_Reg(0x89, NewData);

}
//---------------------------------------------------------------------------
unsigned char Dio3GetInput(void)
{

unsigned char result;


Set_F81866_LD(0x06);

//switch to logic device 6

result = Get_F81866_Reg(0x8A);

return (result);

}