ORG 0H
RD_ADC BIT P3.0
WR_ADC BIT P3.1
INTR_ADC BIT P3.2
MOV P2,#0FFH
SETB INTR_ADC
BACK: CLR WR_ADC
SETB WR_ADC
HERE: JB INTR_ADC, HERE
CLR RD_ADC
MDATA EQU P2
MOV A, MDATA
ACALL CONVERSION
ACALL DATA_DISPLAY
SETB RD_ADC
SJMP BACK
CONVERSION:
BIN_DEC: MOV A,R0
MOV B,#100
DIV AB
MOV R ,A ; R3 CONTAIN HUNDRED NUMBER
MOV A,B
MOV B,#10
DIV AB
MOV R1,A ; R2 CONTAIN TENTH NUMBER
MOV R0,B ; R1 CONTAIN LEFT DECIMAL NUMBER
RET
DATA_DISPLAY:
MOV A,#38H
ACALL CMD
MOV A,#0CH
ACALL CMD
MOV A,#01H
ACALL CMD
MOV A,#82H
ACALL CMD
MOV A,#'T'
ACALL DISPLAY
MOV A,#'E'
ACALL DISPLAY
MOV A,#'M'
ACALL DISPLAY
MOV A,#'P'
ACALL DISPLAY
MOV A,#':'
ACALL DISPLAY
MOV A,R0
ADD A, 30H
ACALL DISPLAY
MOV A,#06H
ACALL CMD
MOV A,R1
ADD A, 30H
ACALL DISPLAY
MOV A,#06H
ACALL CMD
MOV A,R2
ADD A, 30H
ACALL DISPLAY
RET
CMD: MOV P0,A ; issue command code
CLR P1.0 ; clear RS=0, for command
CLR P1.1 ; clear R/W=0, to write to LCD
SETB P1.2 ; set E=1
CLR P1.2 ; clear E=0, to generate an H-to-L pulse
ACALL DELAY ; give LCD some time
RET;
DISPLAY:
MOV P0,A ; issue data
SETB P1.0 ; set RS=1, for data
CLR P1.1 ; clear R/W=0, to write to LCD
SETB P1.2 ; set E=1
CLR P1.2 ; clear E=0, to generate an H-to-L pulse
ACALL DELAY ; give LCD some time
RET;
DELAY:
MOV R3,#03FH
LOOP2:
MOV R4,#0FFH
LOOP1:
DJNZ R4,LOOP1
DJNZ R3,LOOP2
RET
END