Nguyên văn bởi lethu3006
Xem bài viết
Code:
org 0000h mov r0,#0 main: setb p2.0 jb p2.0,m11 mov r0,#1 jmp m21 m11: setb p2.1 jb p2.1,m12 mov r0,#2 jmp m21 m12: setb p2.2 jb p2.2,m21 mov r0,#0 ;phim cancel... m21: cjne r0, #1,m22 call nhay1 jmp m31 m22: cjne r0,#2,m23 call nhay2 jmp m31 m23: jine r0,#0, m31 ; cancel cac port.... hoac chtr nao do m31: jmp main nhay1: mov p3, # 11110000b call delay mov p3, # 00001111b call delay ret nhay2: mov p3, # 00000000b call delay mov p3, # 11111111b call delay ret delay: mov r3, #10 vong1: mov r4, #50 vong2: mov r5, #250 djnz r5, $ djnz r4, vong2 djnz r3, vong1 ret end
Comment