Board logo

标题: PORTA作为输入,却读不进数据 [打印本页]

作者: wang_r00    时间: 2005-12-5 09:58     标题: PORTA作为输入,却读不进数据

我的程序是:

void main(void) {
  /* put your own code here */
  //EnableInterrupts;
  byte test ;
   
  DDRB = 0xff; // PTB as output 
  DDRA = 0x00;  //PTB as input
  
  cDelay(1000);  //延时
  cDelay(1000);  //延时  
  for(;;){
   test = PORTA;  // read can address //   
    if((test & 0x01)==0x01){
      PORTB_BIT4 = 1;       
    }else{
      PORTB_BIT4 = 0;
    }
  } 

}


作者: wang_r00    时间: 2005-12-5 11:42

sorry,以上程序是对的,可以读进来,我失误了




欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) Powered by Discuz! 7.0.0