初学者:虚心请教高手8031对82c55控制8031与82c55相连接(不太准确)但我对82c55的用法不太明白,尤其是对其进行口抵制操作时地
址的变换以及程序如何编,下面有一段程序希望哪位高手给解释一下!!谢谢!void out_port
(unsigned char port_num,unsigned char state){
unsigned char code port_m[8]={0x0a,0x08,0x06,0x04,0x02,0x0,0x0c,0x0e};
if(!state)IOPM=port_m[port_num]+1;
else IOPM=port_m[port_num];
}
//*************************************
unsigned char in_port(unsigned char channel){
unsigned char ip0,ip1;
ip0=0x00;
do{
ip1=ip0;
ip0=IOPB;
delayms(10);
}while(ip0!=ip1);
ip0<<=4-channel;
if(ip0>=128)return 0;
return 1;
}
//************************************void out_port(unsigned char
port_num,unsigned char state){
unsigned char code port_m[8]={0x0a,0x08,0x06,0x04,0x02,0x0,0x0c,0x0e};
if(!state)IOPM=port_m[port_num]+1;
else IOPM=port_m[port_num];
}
//*************************************
unsigned char in_port(unsigned char channel){
unsigned char ip0,ip1;
ip0=0x00;
do{
ip1=ip0;
ip0=IOPB;
delayms(10);
}while(ip0!=ip1);
ip0<<=4-channel;
if(ip0>=128)return 0;
return 1;
}
//************************************