EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
You are here: Home / Topics / Program for the weather station circuit diagram

Program for the weather station circuit diagram

|

Microcontroller › 8051 › Program for the weather station circuit diagram

  • This topic has 1 reply, 1 voice, and was last updated 10 years, 7 months ago by Gangaram.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • December 30, 2011 at 2:37 pm #4915
    Gangaram
    Participant

    Can any one give me the program for the following circuit

     

     

    ;==========================================================
    ;       PIN Definations
    ;==========================================================
    lcddatabus      equ     P2 ;LCD Data Bus   
    lcdrs           equ     P0.7 ;LCD RS         
    lcden           equ     P0.6 ;LCD EN         
     
    adc_data_bus    equ     P1
    adc_add_a       equ     P3.3
    adc_add_b       equ     P3.4
    adc_ale_soc     equ     P3.5
    adc_eoc         equ     P3.6
    adc_oe          equ     P3.7
     
    buzzer           equ     P0.1
    ;==========================================================
    ;       Register & Memory Definations
    ;==========================================================
    Reg_pc_int equ   34h
     
    speed           equ     35h
     
    hex2asc_R0      equ     36h
    hex2asc_R1      equ     37h
    hex2asc_R2      equ     38h
    hex2asc_R3      equ     39h
    Lcd_reg equ     45h
    delreg1         equ     46h
    delreg2         equ     47h
    delreg3         equ     48h
     
    LCD_cursor_R1   equ     3Ah
    LCD_cursor_R2   equ     3Bh
    LCD_cursor_R3   equ     3Ch
     
    adc_op_temp     equ     41h             ;channel 0
    adc_op_humid    equ     43h             ;channel 2
    adc_op_light    equ     44h             ;channel 2
    ;================================================================
                    org 0000h
                    call init
     
    loop:           call adc_temp
                    call adc_humidity
                    call adc_light
     
                    call disp_values
     
                    call temp_ctrl
     
                    call delay1_5sec
     
                    jmp loop
    ;=============================================================
    ;subroutines start from here
    ;=============================================================
    adc_temp:       clr adc_add_b     ;Channel 0 (Temp) is selected
                    clr adc_add_a
                    setb adc_ale_soc        ;ale & soc is made high
                    clr adc_ale_soc         ;ale &  socis made low        
                    jnb adc_eoc,$           ;check for eoc                                        
                    setb adc_oe             ;if eoc high,make oe high
                    mov a,adc_data_bus      ;Read port0 data to acc
                    mov adc_op_temp,a      ;Copy data in Register
                    clr adc_oe              ;make oe low
                    mov a,adc_op_temp
                   ret
    ;=============================================================
    adc_humidity:   clr adc_add_b   ; Channel 1(Humidity) is selected
                    setb adc_add_a
                    setb adc_ale_soc        ;ale & soc is made high
                    clr adc_ale_soc         ;ale &  socis made low        
                    jnb adc_eoc,$           ;check for eoc                                        
                    setb adc_oe             ;if eoc high,make oe high
                    mov a,adc_data_bus      ;Read port0 data to acc
                    mov adc_op_humid,a   ;Copy this data in Register
                    clr adc_oe              ;make oe low
    adc_hum_ret:     ret
    ;=============================================================
    adc_light:      setb adc_add_b   ; Channel 2(Light) is selected
                    clr adc_add_a
                    setb adc_ale_soc        ;ale & soc is made high
                    clr adc_ale_soc         ;ale &  socis made low        
                    jb adc_eoc,$            ;check for eoc 
                    jnb adc_eoc,$           ;check for eoc                                        
                    setb adc_oe             ;if eoc high,make oe high
                    mov a,adc_data_bus      ;Read port0 data to acc
                    mov adc_op_light,a   ;Copy this data in Register
                    clr adc_oe              ;make oe low
    adc_light_ret:     ret
    ;=============================================================
    disp_values:
                    mov sbuf,#’T’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’E’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’M’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’P’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’.’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’=’
                    jnb ti,$
                    clr ti
     
                  mov hex2asc_R0,adc_op_temp
                    call disp_hex2asc
     
                    mov sbuf,#0dfh
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’c’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’ ‘
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’H’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’U’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’M’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’D’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’I’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’T’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’Y’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’=’
                    jnb ti,$
                    clr ti
     
                    mov hex2asc_R0,adc_op_humid
                    call disp_hex2asc
     
                    mov sbuf,#’%’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’R’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’H’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’ ‘
                    jnb ti,$
                    clr ti
                    
     
                    mov sbuf,#’L’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’I’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’G’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’H’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’T’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’=’
                    jnb ti,$
                    clr ti
                    
                    mov hex2asc_R0,adc_op_light
                    call disp_hex2asc
     
                    mov sbuf,#’0′
                    jnb ti,$
                    clr ti
     
                    mov sbuf,#’L’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’U’
                    jnb ti,$
                    clr ti
                    
                    mov sbuf,#’X’
                    jnb ti,$
                    clr ti
                    
                     ret
    ;=============================================================
    disp_hex2asc:   mov a,hex2asc_R0
                    mov b,#100
                    div ab
                    mov hex2asc_R1,a
     
                    mov a,b
                    mov b,#10
                    div ab
                    mov hex2asc_R2,a
                    mov a,b
                    mov hex2asc_R3,a
     
                    mov lcddatabus,LCD_cursor_R1
                    call lcdcmd
                    mov lcddatabus,hex2asc_R1
                    call lcddata
     
                    mov a,hex2asc_R1
                    mov sbuf,a
                    jnb ti,$
                    clr ti
     
                    mov lcddatabus,LCD_cursor_R2
                    call lcdcmd
                    mov lcddatabus,hex2asc_R2
                    call lcddata
     
                    mov a,hex2asc_R2
                    mov sbuf,a
                    jnb ti,$
                    clr ti
     
                    mov lcddatabus,LCD_cursor_R3
                    call lcdcmd
                    mov lcddatabus,hex2asc_R3
                    call lcddata
     
                    mov a,hex2asc_R3
                    mov sbuf,a
                    jnb ti,$
                    clr ti
                    ret
    ;=============================================================
    temp_ctrl: 
                    mov a,adc_op_temp
                    clr c
                    subb a,#35
                    jnc buzzer_off
     
                    setb buzzer
                    mov dptr,#tempincr
                    call pc_int
    temp_ctrl_ret1: ret
     
    buzzer_off:
                    clr buzzer
                    mov dptr,#tempdecr
                    call pc_int
    temp_ctrl_ret2: ret
    ;=============================================================
    init:
                    call lcdinit
     
    mov scon,#50h
                    mov tmod,#21h
                    mov th1,#0FAh
                    mov tl1,#0FAh
                    setb tr1
     
                    mov dptr,#lcddispval
                    call lcddisp
                    ret
    ;================================================================
    lcdinit:         
                    mov lcddatabus,#38h
                    call lcdcmd
                    mov lcddatabus,#0ch
                    call lcdcmd
                    mov lcddatabus,#01h
                    call lcdcmd
                    mov lcddatabus,#06h
                    call lcdcmd
                    ret
    ;=============================================================
    lcdcmd:          clr lcdrs
                    setb lcden
                    clr lcden
                    call lcddelay
                    ret                        
    ;=============================================================
    lcddata:         setb lcdrs
                    setb lcden
                    clr lcden
                    call lcddelay
                    ret
    ;=============================================================
    lcddelay:        mov delreg1,#08             ;LCD
    lcddelay1:       mov delreg2,#250
                    djnz delreg2,$
                    djnz delreg1,lcddelay1
                    ret
    ;=============================================================
    lcddisp:         mov lcddatabus,#01h
                    call lcdcmd
    lcddisp2:        mov a,lcd_reg
                    movc a,@a+dptr
                    cjne a,#’$’,lcddisp1
                    mov lcddatabus,#0c0h
                    call lcdcmd
                    jmp lcddisp2
    lcddisp1:        cjne a,#’@’,lcddisp3
                    ret
    lcddisp3:        mov lcddatabus,a
                    call lcddata
                   jmp lcddisp2
    ;=============================================================
    delay1_5sec:       mov delreg1,#15
    delay1_5sec1:      mov delreg2,#200
    delay1_5sec2:      mov delreg3,#250
                     djnz delreg1,$
                     djnz delreg2,delay1_5sec2
                     djnz delreg3,delay1_5sec1
                     ret
    ;=============================================================
    ;       PC INTERFACING 
    ;=============================================================
    pc_int:         mov a,Reg_pc_int
                    movc a,@a+dptr
                    cjne a,#’$’,pc_int1
     
                    mov a,#’ ‘
                    mov sbuf,a
                    jnb ti,$
                    clr ti
     
                    jmp pc_int
     
    pc_int1:         cjne a,#’@’,pc_int3
                    mov a,#10
                    mov sbuf,a
                    jnb ti,$
                    clr ti
                    mov a,#13
                    mov sbuf,a
                    jnb ti,$
                    clr ti
                    ret
     
    pc_int3:         mov sbuf,a
                    jnb ti,$
                    clr ti
                    jmp pc_int
    ;=============================================================
     
    lcddispval:     db “T=   “,0dfh,”c H=   %[email protected]=   0LUX       $”
     
    tempincr:  db “TEMPERATURE INCREASED ABOVE SET LEVEL BUZZER TURNED ON”
     
    tempdecr:  db “TEMPERATURE DECREASED BELOW SET LEVEL BUZZER TURNED OFF”
     
    ;=============================================================
    ;       Program ENDs here
    ;=============================================================
    END
     
    ***
    This above program is working but LCD is not displaying any value
    Please help me in correcting/rectifying errorsin the above code to work with the following circuit Design

     

    Temperature,Humidity and Light

    January 2, 2012 at 1:29 am #6973
    Gangaram
    Participant

    Please help me to program the above circuit.

    J1–>LM35

    J2–>SY HS 220

    J3–>LDR

     

     

    The above program mentioned is not displaying me any values on the LCD screen

    I’m using Keil software for compilation and creating/generating hex file

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Washing Machine motor August 14, 2022
  • arduino help needed August 14, 2022
  • Looking for amplifier ic August 14, 2022
  • Light Automation via mqtt August 14, 2022
  • Right channel distortion on vintage fisher rs-2010 August 14, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools