NAR-5620 Series
User
’
s
Manual
54
void exit_GPIO()
{
//Exit the extended function mode
outport(0x2e,0xaa);
}
void GPIO_test()
{
int check1,check2,x,indata;
init_GPIO();
display_line(1 , 5, "
Start Testing ...
", 14,1);
//*********************
Test
GPIO
P0
input
and
P1
output
***************************************/
display_line(1,7, "
?GPIO P0 input and P1 output Test :", 14,1);
outport(0x2e,0xf0);
outport(0x2f,0x10);
//GP14 =Input GP15=output
// GP15 output 0 and GP14 input
outport(0x2e,0xf1);
outport(0x2f,0x00);
indata=inport(0x2f);
check1=indata & 0x10;
outport(0x2e,0xf0);
outport(0x2f,0x10);
//GP14 =Input GP15=output
// GP15 output 1 and GP14 input
outport(0x2e,0xf1);
outport(0x2f,0x20);
indata=inport(0x2f);
check2=indata & 0x10;
///if ((check1==1) && (check2==0)) display_line(50 ,7, "PASS", 15,1);
if ((check1==0x10) && (check2==0x00)) display_line(50 ,7, "PASS", 15,1);
else {display_line(50 ,7, "FAIL", 12,1);fail_beep();}