Ví dụ khi nhấn phím jnb p2.4,so0, thì nó nhảy xuống nhãn so0 sau đó thì nhảy tiếp xuống nhãn so01 tới đây nó hiển thị số 0 rồi nó lại nhảy về main. Nhưng tại sao nó lại ko mất số 0 mà nó cứ giữ hoài. Ai giải thích giúp mình với
1.hex
1.dsn
Đây là hình mô phỏng
CODE:
org 0000h
main:
; xxxxxxxxxxxxx hang 1 xxxxxxxxxxxxxxxxxxxx
mov p2,#11111110b
jnb p2.4,so0
jnb p2.5,so1
jnb p2.6,so2
jnb p2.7,so3
; xxxxxxxxxxxxxxxx hang 2 xxxxxxxxxxxxxxxx
mov p2,#11111101b
jnb p2.4,so4
jnb p2.5,so5
jnb p2.6,so6
jnb p2.7,so7
; xxxxxxxxxxxxxxx hang 3 xxxxxxxxxxxxxxxxx
mov p2,#11111011b
jnb p2.4,so8
jnb p2.5,so9
jnb p2.6,chua
jnb p2.7,chub
; xxxxxxxxxxxxxx hang 4 xxxxxxxxxxxxxxxxxx
mov p2,#11110111b
jnb p2.4,chuc
jnb p2.5,chud
jnb p2.6,chue
jnb p2.7,chuf
ljmp main
; xxxxxxxxxxxx nhay xxxxxxxxxxxxxxxxx
so0: ljmp so01
so1: ljmp so11
so2: ljmp so21
so3: ljmp so31
so4: ljmp so41
so5: ljmp so51
so6: ljmp so61
so7: ljmp so71
so8: ljmp so81
so9: ljmp so91
chua: ljmp chua1
chub: ljmp chub1
chuc: ljmp chuc1
chud: ljmp chud1
chue: ljmp chue1
chuf: ljmp chuf1
so01: mov p1,#0c0h
ljmp main
so11: mov p1,#0f9h
ljmp main
so21: mov p1,#0a4h
ljmp main
so31: mov p1,#0b0h
ljmp main
so41: mov p1,#99h
ljmp main
so51: mov p1,#92h
ljmp main
so61: mov p1,#82h
ljmp main
so71: mov p1,#0f8h
ljmp main
so81: mov p1,#00h
ljmp main
so91: mov p1,#90h
ljmp main
chua1: mov p1,#00001000b
ljmp main
chub1: mov p1,#00000000b
ljmp main
chuc1: mov p1,#01110000b
ljmp main
chud1: mov p1,#00100001b
ljmp main
chue1: mov p1,#00000110b
ljmp main
chuf1: mov p1,#10001110b
ljmp main
end
1.hex
1.dsn
Đây là hình mô phỏng
CODE:
org 0000h
main:
; xxxxxxxxxxxxx hang 1 xxxxxxxxxxxxxxxxxxxx
mov p2,#11111110b
jnb p2.4,so0
jnb p2.5,so1
jnb p2.6,so2
jnb p2.7,so3
; xxxxxxxxxxxxxxxx hang 2 xxxxxxxxxxxxxxxx
mov p2,#11111101b
jnb p2.4,so4
jnb p2.5,so5
jnb p2.6,so6
jnb p2.7,so7
; xxxxxxxxxxxxxxx hang 3 xxxxxxxxxxxxxxxxx
mov p2,#11111011b
jnb p2.4,so8
jnb p2.5,so9
jnb p2.6,chua
jnb p2.7,chub
; xxxxxxxxxxxxxx hang 4 xxxxxxxxxxxxxxxxxx
mov p2,#11110111b
jnb p2.4,chuc
jnb p2.5,chud
jnb p2.6,chue
jnb p2.7,chuf
ljmp main
; xxxxxxxxxxxx nhay xxxxxxxxxxxxxxxxx
so0: ljmp so01
so1: ljmp so11
so2: ljmp so21
so3: ljmp so31
so4: ljmp so41
so5: ljmp so51
so6: ljmp so61
so7: ljmp so71
so8: ljmp so81
so9: ljmp so91
chua: ljmp chua1
chub: ljmp chub1
chuc: ljmp chuc1
chud: ljmp chud1
chue: ljmp chue1
chuf: ljmp chuf1
so01: mov p1,#0c0h
ljmp main
so11: mov p1,#0f9h
ljmp main
so21: mov p1,#0a4h
ljmp main
so31: mov p1,#0b0h
ljmp main
so41: mov p1,#99h
ljmp main
so51: mov p1,#92h
ljmp main
so61: mov p1,#82h
ljmp main
so71: mov p1,#0f8h
ljmp main
so81: mov p1,#00h
ljmp main
so91: mov p1,#90h
ljmp main
chua1: mov p1,#00001000b
ljmp main
chub1: mov p1,#00000000b
ljmp main
chuc1: mov p1,#01110000b
ljmp main
chud1: mov p1,#00100001b
ljmp main
chue1: mov p1,#00000110b
ljmp main
chuf1: mov p1,#10001110b
ljmp main
end
Comment