Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Displaying values from ADC 0804 in LCD 16x2

Status
Not open for further replies.

ressaly

Newbie level 2
Joined
Aug 18, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
Dear experts,
I'm working on a projects that involves taking the temperature values from LM35 through ADC0804, and then display them on the LCD.
My code is as follows:
Code:
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
But the LCD only shows "Temp: 000"
The circuit seems to be as it should.
I also need to implement an extra code in order to be able to control a dc motor controlled through P3.3 and perform 3 different speeds according to the temperature range..
I have already been all around the net looking in English, French, Malayu, Chinese, Indian.. And tested a dozen of techniques and codes without any luck.
Could you please help me, or at least advice me

Thank you
 

Dear My friend
Look at my attachment and i will support any question

Best Regards

MedTronic

 

Attachments

  • adc0808Schematic.pdf
    43.5 KB · Views: 116
  • adc0808.rar
    110.5 KB · Views: 121
Thanks for the reply brother Medhat,
Unfortunately I'm using adc0804 not adc0808 + I'm required to do it using assembly.
 

Good my friend ... can you modulate my project .... the adc0804 is the same as adc0808 and if you can't ..... give me a time only
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top