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.

problem interfacing at89c51,adc0804 and displaying on LCD

Status
Not open for further replies.

pandeeey

Newbie level 3
Joined
Jan 29, 2010
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
nepal
Activity points
1,363
i am a third year engineering student,i am doing my project on temperature control and monitoring syestem,i have used adc0804 for a/d conversion and 89c51 microcontroller with delay of 10 seconds,need display it on a lcd with 2 lines one for displaying monitored temperature and the other one to input the required temperature ......i am facing problem with assembly language programming,i want to check my program using proteus,but i dont know how to use it.can someone mail me the codes for interfacing... plz help me.......
 

Re: problem interfacing at89c51,adc0804 and displaying on LC

It's been a long time since i used assemble, try using basic or c it will be more easy

and quick , but still i had it for my last experiment please check the code. I use mide for compile it

http://www.opcube.com/home.html it's free and great software can compile assembler and c (sdcc)

Code:
$TITLE(ADC and LCD)
$MOD51
		DSEG
		ORG	0030H
hundreds	equ	 031h			;Buffer for hundreds for data adc
tens    	equ  032h			
unit        equ  033h
;
        CSEG
       	org 0100h
start: 	
        lcall init_lcd 
        lcall ADC
       	lcall Bin2Dec
       	
       	mov r1,#80h
       	call Write_inst    ; this means move cursor to line 1 lcd if you want to use line 2 lcd use C0H
       	mov r1,hundreds
       	call Write_data
       	mov r2,tens
       	call Write_data
       	mov r1,unit
       	call Write_data
sjmp start
;
;=================================================
;Subrutine ADC for get adc data(use free running ADC mode)
; ADC port using port 1
; WR ADC port 3.3
; RD ADC port 3.4
; CS ADC connect to ground
;=================================================
ADC:	
    clr P3.3
	nop
	nop
	nop
	setb P3.3
eoc:	
    jb P3.2,eoc
	clr P3.4
	mov A,P1
	setb P3.4
	ret	
;
;==================================================
;Subrutin to convert Binary Data to Decimal Data
; example 254 ==> hundreds = 2, 5 = tens and 4 = unit
;==================================================
Bin2Dec:
       mov b,#100d
       div ab
       mov hundreds,a
       mov a,b
       mov b,#10d
       div ab
       mov tens,a
       mov unit,b
       ret     
       
;========================================
; Subroutine LCD initialization ( iuse lcd x x 16)
;========================================         
Init_lcd:
    mov r1,#00000001b ;Display clear
    acall write_inst  ;
    mov r1,#00111000b ;Function set,
                      ;Data 8 bit,2 line font 5x7
    acall write_inst  ;
    mov r1,#00001100b ;Display on, 
                      ;cursor off,cursor blink off
    acall write_inst
    mov r1,#00000110b ;Entry mode, Set increment
    acall write_inst
    ret

;==========================================
; Subroutine Write command to LCD
;=========================================
Write_inst:
    clr P2.0  ; RS = P2.0 = 0, write mode instruction
    mov P0,R1 ; D7 s/d D0 = P0 = R1
    setb P2.1 ; EN = 1 = P2.1 
    call delay; call delay time
    clr P2.1  ; EN = 0 = P2.1
    ret

;========================================
; Sub routine write data to lcd
;========================================
Write_data:
    setb P2.0 ; RS = P2.0 = 1, write mode data
    mov P0,R1 ; D7 s/d D0 = P0 = R1
    setb P2.1 ; EN = 1 = P2.1
    call delay; call delay time
    clr p2.1  ; EN = 0 = P2.1
    ret
    
;=============================
; Delay Subroutine
;============================
delay: 	mov R0,#0ffh
delay1:mov R7,#0ffh
       	djnz R7,$
       	djnz R0,delay1
       	ret

end

check the schematic

1. ADC schecmatic


2. LCD schematic


hope this help u

for more information u can visit this website
http://www.mytutorialcafe.com great tutorial from INDONESIA you'll love it


DENY (Bodat'z)
 

    pandeeey

    Points: 2
    Helpful Answer Positive Rating
Re: problem interfacing at89c51,adc0804 and displaying on LC

brothrs i need some help regarding interfacing ADC0804 and AT89c51
i connected lm35dz temp sensor to adc0804(i am using the same code and circuit diagram ,which in mazeedi 8051 programming/actually when ever i send low to read pin of ADC0804 to get the converted data out,it causes my program execution to stop and other functions doesn't execute .but if i skip the execution of that command, to low the read pin of my ADC the prog executes rightly but it doesn't convert temp into binary.(i know why)
plz hlp me.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top