实际仿真和运行的时候,程序好像都没有按照想法去跑,程序如下:
ORG 0x00; INIT MOVLW 0x00; MOVWF OSCCAL; MOVLW 0x00; OPTION ;
MOVLW 0x0C; 设置GP3为输入,配置字中也使能GP3 TRIS GPIO; EE MOVLW 0x00;
MOVWF GPIO; CALL DELAY100MS; GP0口接LED,低电平亮 MOVLW 0x03; MOVWF GPIO; CALL DELAY500MS; MOVF GPIO,0; 此处GP3口为高电平 BTFSC W,3; GOTO EE; 此句被跳过。。。 CALL DELAY10MS; MOVF GPIO,0; BTFSC W,3; GOTO EE; KEYUP MOVF GPIO,0; BTFSS W,1; GOTO KEYUP; CALL DELAY10MS; MOVF GPIO,0; BTFSS W,1; GOTO KEYUP; waiting for loose the press MOVF GPIO,0; read GPIO before sleep SLEEP ; GOTO INIT;
我没按下按键,GP3口电平为高(用示波器看过),按理LED应该继续闪烁,可是实际上却跟读到低电平一样,跳过了GOTO EE;请问是什么原因啊?
|