导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→初学者:虚心请教高手8031对82c55控制[lg0213]

 *第1863篇: 初学者:虚心请教高手8031对82c55控制

  
楼 主:lg0213 2002年1月8日08:32
 初学者:虚心请教高手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;
}
//************************************

>>>>>>对该主题发表你的看法

本主题贴数1,分页: [第1页]


[上一篇主题]:闲聊:好长时间进不了www.embed.com.cn 和www.c51bbs.com,请问

[下一篇主题]:初学者:**** 51控制電腦PCI卡  ****