Need help with asm code for 8051 using lm35 and adc0804

Discussion in 'Embedded Systems and Microcontrollers' started by randomgaisha, Feb 25, 2013.

  1. randomgaisha

    Thread Starter New Member

    Feb 25, 2013
    1
    0
    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
    http://www.flickr.com/photos/60242244@N02/8508718148/in/photostream

    current code:

    Code ( (Unknown Language)):
    1.  
    2. $mod51
    3. rw equ P3.1
    4. rs equ P3.0
    5. en equ P3.2
    6.  
    7. org 0000h
    8.  
    9. clr rw
    10. acall lcd_init
    11. main:
    12. mov a, #'W'
    13. acall lcd_data
    14. mov a,#'e'
    15. acall lcd_data
    16. mov a, #'l'
    17. acall lcd_data
    18. mov a,#'c'
    19. acall lcd_data
    20. mov a, #'o'
    21. acall lcd_data
    22. mov a,#'m'
    23. acall lcd_data
    24. mov a, #'e'
    25. acall lcd_data
    26. mov a,#' '
    27. acall lcd_data
    28. mov a,#'K'
    29. acall lcd_data
    30. mov a,#'e'
    31. acall lcd_data
    32. mov a,#'i'
    33. acall lcd_data
    34. mov a,#'t'
    35. acall lcd_data
    36. mov a,#'h'
    37. acall lcd_data
    38. sjmp $
    39.  
    40.  
    41. lcd_init:
    42. mov a,#01h
    43. acall lcd_cmd
    44. mov a,#38h
    45. acall lcd_cmd
    46. mov a,#0ch
    47. acall lcd_cmd
    48. mov a,#06h
    49. acall lcd_cmd
    50. ret
    51.  
    52.  
    53. lcd_cmd:
    54. clr rs
    55. mov p2,a
    56. setb en
    57. acall delay
    58. clr en
    59. ret
    60.  
    61. lcd_data:
    62. setb rs
    63. mov p2,a
    64. setb en
    65. acall delay
    66. clr en
    67. ret
    68.  
    69. delay:
    70. mov r0,#5h
    71. l2: mov r1,#0ffh
    72. l1: djnz r1,l1
    73.     djnz r0,l2
    74. ret
    75.  
    76.  
    77.  
    78. end
    79.  
    80.  
     
Loading...