các anh giúp em dịch chi tiết doạn code này nha.
nếu ai co mạch in thì cho em vói
em cảm ơn trước nha >
bai2: mach cam bien nhiet do dung lm35 ,adc 0804 va AT89C51
LED EQU P0
DATA_ADC EQU P1
;CAC BIT GIAO TIEP ADC
INTR BIT P3.7
WR_ADC BIT P3.5
RD_ADC BIT P3.6
;VUNG NHO NHIET DO
DONVI EQU 40H
CHUC EQU 41H
TRAM EQU 42H
;CAC BIT QUET LED
L1 BIT P2.4
L2 BIT P2.3
L3 BIT P2.2
L4 BIT P2.1
L5 BIT P2.0
ORG 0000H
MOV DATA_ADC,#0FFH ;P1 DAU VAO DU LIEU
MOV DPTR,#MALED7
MOV LED,#00H
MOV DONVI,#00H
MOV CHUC,#00H
MOV TRAM,#00H
MAIN:
lcall READ_ADC
CALL DISPLAY
JMP MAIN
READ_ADC:
CLR WR_ADC ;BAT DAU CHUYEN DOI
SETB WR_ADC
HERE: JB INTR,HERE ;CHO CHUYEN DOI XONG
CLR RD_ADC
SETB RD_ADC
MOV A,DATA_ADC
CALL BIN2BCD
RET
BIN2BCD:
MOV B,#10
DIV AB
MOV DONVI,B
MOV B,#10
DIV AB
MOV CHUC,B
MOV TRAM,A
RET
DISPLAY:
MOV LED,#0C6H ;DUA KY HIEU 'C' RA LED7
SETB L5 ;CHO LED 5 SANG
CALL DELAY ;TRE
CLR L5 ;TAT LED 5
MOV LED,#9CH ;DUA KY HIEU 'DO' RA LED7
SETB L4 ;CHO LED 4 SANG
CALL DELAY
CLR L4
MOV A,DONVI ;DUA SO HANG DON VI RA
MOVC A,@A+DPTR ;LAY MA LED7 TUONG UNG CUA HANG DON VI
MOV LED,A ;XUAT RA LED7
SETB L3 ;CHO LED 3 SANG
CALL DELAY
CLR L3
MOV A,CHUC ;DUA SO HANG DON VI RA
MOVC A,@A+DPTR ;LAY MA LED7 TUONG UNG CUA HANG CHUC
MOV LED,A ;XUAT RA LED7
SETB L2 ;CHO LED 2 SANG
CALL DELAY
CLR L2
MOV A,TRAM ;DUA SO HANG DON VI RA
MOVC A,@A+DPTR ;LAY MA LED7 TUONG UNG CUA HANG TRAM
MOV LED,A ;XUAT RA LED7
SETB L1 ;CHO LED 1 SANG
CALL DELAY
CLR L1
RET
DELAY:
MOV R7,#50
DJNZ R7,$
RET
delay_120us:
mov R6,60
loop3: djnz R6,loop3 ; 2us x 60 = 120uS
ret
MALED7:
DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
; KY HIEU 'D0' KY HIEU 'C'
;DB 9CH 0C6H
END
nếu ai co mạch in thì cho em vói
em cảm ơn trước nha >
bai2: mach cam bien nhiet do dung lm35 ,adc 0804 va AT89C51
LED EQU P0
DATA_ADC EQU P1
;CAC BIT GIAO TIEP ADC
INTR BIT P3.7
WR_ADC BIT P3.5
RD_ADC BIT P3.6
;VUNG NHO NHIET DO
DONVI EQU 40H
CHUC EQU 41H
TRAM EQU 42H
;CAC BIT QUET LED
L1 BIT P2.4
L2 BIT P2.3
L3 BIT P2.2
L4 BIT P2.1
L5 BIT P2.0
ORG 0000H
MOV DATA_ADC,#0FFH ;P1 DAU VAO DU LIEU
MOV DPTR,#MALED7
MOV LED,#00H
MOV DONVI,#00H
MOV CHUC,#00H
MOV TRAM,#00H
MAIN:
lcall READ_ADC
CALL DISPLAY
JMP MAIN
READ_ADC:
CLR WR_ADC ;BAT DAU CHUYEN DOI
SETB WR_ADC
HERE: JB INTR,HERE ;CHO CHUYEN DOI XONG
CLR RD_ADC
SETB RD_ADC
MOV A,DATA_ADC
CALL BIN2BCD
RET
BIN2BCD:
MOV B,#10
DIV AB
MOV DONVI,B
MOV B,#10
DIV AB
MOV CHUC,B
MOV TRAM,A
RET
DISPLAY:
MOV LED,#0C6H ;DUA KY HIEU 'C' RA LED7
SETB L5 ;CHO LED 5 SANG
CALL DELAY ;TRE
CLR L5 ;TAT LED 5
MOV LED,#9CH ;DUA KY HIEU 'DO' RA LED7
SETB L4 ;CHO LED 4 SANG
CALL DELAY
CLR L4
MOV A,DONVI ;DUA SO HANG DON VI RA
MOVC A,@A+DPTR ;LAY MA LED7 TUONG UNG CUA HANG DON VI
MOV LED,A ;XUAT RA LED7
SETB L3 ;CHO LED 3 SANG
CALL DELAY
CLR L3
MOV A,CHUC ;DUA SO HANG DON VI RA
MOVC A,@A+DPTR ;LAY MA LED7 TUONG UNG CUA HANG CHUC
MOV LED,A ;XUAT RA LED7
SETB L2 ;CHO LED 2 SANG
CALL DELAY
CLR L2
MOV A,TRAM ;DUA SO HANG DON VI RA
MOVC A,@A+DPTR ;LAY MA LED7 TUONG UNG CUA HANG TRAM
MOV LED,A ;XUAT RA LED7
SETB L1 ;CHO LED 1 SANG
CALL DELAY
CLR L1
RET
DELAY:
MOV R7,#50
DJNZ R7,$
RET
delay_120us:
mov R6,60
loop3: djnz R6,loop3 ; 2us x 60 = 120uS
ret
MALED7:
DB 0C0H,0F9H,0A4H,0B0H,99H,92H,82H,0F8H,80H,90H
; KY HIEU 'D0' KY HIEU 'C'
;DB 9CH 0C6H
END
Comment