Need help with asm code to finish sensor using 8051 lm35 and adc0804

Status
Not open for further replies.

randomgaisha

Newbie level 1
Joined
Feb 25, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,288
hi wondering if anyone can help me out with this, ive got the lcd displaying information, but i want it to display the temperature using the lm35 and adc0804 as well, using asm code. Basically i need to get the current reading from the lm35 and convert them in the adc0804 and then display that reading in degrees on the lcd display. I have found some similar projects like this but they were written in C. any help needed, thanks in advance

current embedded image
**broken link removed**

current code:

Code:
$mod51
rw equ P3.1
rs equ P3.0
en equ P3.2

org 0000h

clr rw
acall lcd_init
main:
mov a, #'W'
acall lcd_data
mov a,#'e'
acall lcd_data
mov a, #'l'
acall lcd_data
mov a,#'c'
acall lcd_data
mov a, #'o'
acall lcd_data
mov a,#'m'
acall lcd_data
mov a, #'e'
acall lcd_data
mov a,#' '
acall lcd_data
mov a,#'K'
acall lcd_data
mov a,#'e'
acall lcd_data
mov a,#'i'
acall lcd_data
mov a,#'t'
acall lcd_data
mov a,#'h'
acall lcd_data
sjmp $


lcd_init:
mov a,#01h
acall lcd_cmd
mov a,#38h
acall lcd_cmd
mov a,#0ch
acall lcd_cmd
mov a,#06h
acall lcd_cmd
ret


lcd_cmd:
clr rs
mov p2,a
setb en
acall delay
clr en
ret

lcd_data:
setb rs
mov p2,a
setb en
acall delay
clr en
ret

delay:
mov r0,#5h
l2: mov r1,#0ffh
l1: djnz r1,l1
    djnz r0,l2
ret



end
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…