我的程序是:
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; } }
} |