Vous êtes sur la page 1sur 10

org 0000h mov p0,#00h mov p2,#00h mov p1,#0ffh mov p3,#00h mov sp,#40h lcall int_

main: lcall read_s1 lcall delay1s lcall read_s2 lcall delay1s lcall read_s3 lcall delay1s lcall read_s4 lcall delay1s sjmp main

read_s1:

mov a, #083h acall command setb p2 4 lcall delay

mov a,p1 clr p2 4 cjne a,#30,test1 on1: setb p3 ! lcall conv_disp rr1: ret

test1: jc on1 clr p3 ! lcall conv_disp sjmp rr1

read_s2: mov a, #08ah acall command setb p2 1 lcall delay mov a,p1 clr p2 1 cjne a,#110,test2 on2: clr p3 " lcall conv_disp rr2: ret

test2: jc on2 setb p3 " lcall conv_disp sjmp rr2

read_s3: mov a, #0c3h acall command setb p2 2 lcall delay mov a,p1 clr p2 2 cjne a,#88,test3 on3: clr p3 # lcall conv_disp rr3: ret

test3: jc on3 setb p3 # lcall conv_disp sjmp rr3

read_s4:

mov a, #0cah acall command setb p2 3 lcall delay mov a,p1 clr p2 3 cjne a,#130,test4 on4: setb p3 4 lcall conv_disp rr4: ret

test4: jc on4 clr p3 4 lcall conv_disp sjmp rr4

conv_disp:

setb ps$ 4 mov b,#10 div ab mov r",b mov b,#10 div ab mov r!,b add a,#30h

acall display mov a,r! add a,#30h acall display mov a,r" add a,#30h acall display clr ps$ 4 ret

int_: mov a, #38h acall command acall delay mov a, #01h acall command acall delay mov a, #0eh acall command acall delay mov a, #0"h acall command acall delay mov a, #81h acall command

mov dptr,#sho$0 acall dis_ acall delay mov a,#0c1h acall command acall delay mov dptr,#sho$1 acall dis_ acall delay1s acall delay1s acall delay1s acall delay1s mov a, #01h acall command acall delay mov a, #81h acall command mov dptr,#sho$01 acall dis_ acall delay mov a,#0c1h acall command acall delay mov dptr,#sho$11 acall dis_ acall delay1s

acall delay1s acall delay1s acall delay1s acall delay1s mov a, #01h acall command acall delay mov a, #80h acall command mov dptr,#sho$2 acall dis_ acall delay mov a,#8!h acall command acall delay mov dptr,#sho$3 acall dis_ acall delay mov a, #0c0h acall command mov dptr,#sho$4 acall dis_ acall delay mov a,#0c!h acall command acall delay

mov dptr,#sho$# acall dis_ acall delay ret

command: clr p2 # clr p2 " mov p0,a setb p2 ! acall delay clr p2 ! ret

display: setb p2 # clr p2 " mov p0,a setb p2 ! acall delay clr p2 ! ret

dis_:

mov a,#00h movc a,%a&dptr cjne a,#'0',(p sjmp do$n

(p: acall display inc dptr sjmp dis_ do$n: nop ret

delay: mov r1, #1 here3: mov r2,#10 here2: mov r3,#12# here1: djn) r3,here1 djn) r2,here2 djn) r1, here3 ret

delay1s:

mov r1, #4! here": mov r2,#100

here#: mov r3,#100 here4: djn) r3,here4 djn) r2,here# djn) r1, here"

ret

sho$0: db '*+,,- ./+/0,1,+','0' sho$1: db ' 23-1+34 5651,0','0' sho$01: db '12,1 7-83+,','0' sho$11: db '9,4230,5 63:','0' sho$2: db 't; ','0' sho$3: db 'i ; ','0' sho$4: db 'h ; ','0' sho$#: db 'l ; ','0'

end