IBASE Technology MI808 User Manual - page 75
APPENDIX
MI808 User’s Manual
71
//set FDC_GP_EN(bit3), should clear UR_GP_PROG_EN (reg26,bit0) first
ucBuf = Get_F81865_Reg(0x26);
ucBuf &= ~BIT0;
Set_F81865_Reg(0x26, ucBuf);//clear UR_GP_PROG_EN = 0 (reg26,bit0)
ucBuf = Get_F81865_Reg(0x2A);
ucBuf |= BIT3;
//set FDC_GP_EN(bit3),
Set_F81865_Reg(0x2a, ucBuf);
//< Set_F81865_LD(0x06); //switch to logic device 6 //enable the GP5 group ucBuf = Get_F81865_Reg(0x30); ucBuf |= 0x01; Set_F81865_Reg(0x30, ucBuf); Set_F81865_Reg(0xA0, 0x00); //define as input mode Set_F81865_Reg(0xA3, 0xFF); //push pull mode } //--------------------------------------------------------------------------- void Dio5SetOutput(unsigned char NewData) { Set_F81865_LD(0x06); //switch to logic device 6 Set_F81865_Reg(0xA1, NewData); } //--------------------------------------------------------------------------- unsigned char Dio5GetInput(void) { unsigned char result; Set_F81865_LD(0x06); //switch to logic device 6 result = Get_F81865_Reg(0xA2); return (result); } //--------------------------------------------------------------------------- void Dio5SetDirection(unsigned char NewData) { //NewData : 1 for input, 0 for output Set_F81865_LD(0x06); //switch to logic device 6 Set_F81865_Reg(0xA0, NewData); } //--------------------------------------------------------------------------- unsigned char Dio5GetDirection(void) { unsigned char result; Set_F81865_LD(0x06); //switch to logic device 6 result = Get_F81865_Reg(0xA0); return (result); } //---------------------------------------------------------------------------