本帖最后由 thy110 于 2014-12-13 11:00 编辑
最近在用汇编编写独立按键的程序时,输出总是不稳定,用于测试的led灯总是闪烁,怎么回事啊,之前用c写的就很正常,按照原来的思路一步一步写下来就不正常了,大家帮忙看看。
- ORG 0000H
- LJMP START
- ORG 0200H
- START:MOV P1,#0FFH
- LOOP: LCALL DELAY_10MS
- MOV A,P1
- MOV R1,A
- CPL A
- ANL A,#0FFH
- JZ LOOP
- LCALL DELAY_10MS
- MOV A,P1
- MOV R1,A
- CPL A
- ANL A,#0FFH
- JZ LOOP
- ACALL SKEY
- SJMP LOOP
- SKEY: MOV A,R1
- JNB ACC.0,KEY1
- JNB ACC.1,KEY2
- JNB ACC.2,KEY3
- JNB ACC.3,KEY4
- JNB ACC.4,KEY5
- JNB ACC.5,KEY6
- JNB ACC.6,KEY7
- JNB ACC.7,KEY8
- RET
- KEY1: CPL P0.4
- RET
- KEY2: CPL P0.4
- RET
- KEY3: CPL P0.4
- RET
- KEY4: CPL P0.4
- RET
- KEY5: CPL P0.4
- RET
- KEY6: CPL P0.4
- RET
- KEY7: CPL P0.4
- RET
- KEY8: CPL P0.4
- RET
- DELAY_10MS:MOV R7,#10H
- TS1: MOV R6,#0FFH
- TS2: DJNZ R6,TS2
- DJNZ R7,TS1
- RET
- END
复制代码
一周热门 更多>