Các bác có thể giúp em sửa đoạn code này k a?
dùng 1 nút nhấn dk: nhấn lần 1 gọi ct1, lần 2 gọi ct2 , lần n gọi ct n
;-------------------------
org 0000h
main:
MOV 29H, #0
;--------------------------------
JB P1.1, back
JNB P1.1, $
INC 29H
MOV A, 29H
CJNE A, #01, back
call ss
lcall delay
CJNE A, #02, back
call tt
lcall delay
CJNE A, #06, back
call dd
lcall delay
back: RET
jmp main
;-------------------------------
ss:
mov p1,#0ffh
lcall delay
mov p1,0
lcall delay
ret
;-----------------------
tt:
mov p1,#00000000b
lcall delay
mov p1,#01010101b
lcall delay
ret
;------------------
dd:
mov p1,#11110000b
lcall delay
mov p1,#00001111b
lcall delay
ret
;---------------
delay: mov 7eh,#255
del: mov 7fh,#0ffh
djnz 7fh,$
djnz 7eh,del
ret
end
dùng 1 nút nhấn dk: nhấn lần 1 gọi ct1, lần 2 gọi ct2 , lần n gọi ct n
;-------------------------
org 0000h
main:
MOV 29H, #0
;--------------------------------
JB P1.1, back
JNB P1.1, $
INC 29H
MOV A, 29H
CJNE A, #01, back
call ss
lcall delay
CJNE A, #02, back
call tt
lcall delay
CJNE A, #06, back
call dd
lcall delay
back: RET
jmp main
;-------------------------------
ss:
mov p1,#0ffh
lcall delay
mov p1,0
lcall delay
ret
;-----------------------
tt:
mov p1,#00000000b
lcall delay
mov p1,#01010101b
lcall delay
ret
;------------------
dd:
mov p1,#11110000b
lcall delay
mov p1,#00001111b
lcall delay
ret
;---------------
delay: mov 7eh,#255
del: mov 7fh,#0ffh
djnz 7fh,$
djnz 7eh,del
ret
end