Microcontroller › 8051 › Program for the weather station circuit diagram
- This topic has 1 reply, 1 voice, and was last updated 13 years, 2 months ago by
Gangaram.
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
December 30, 2011 at 2:37 pm #4915
Gangaram
ParticipantCan any one give me the program for the following circuit
;==========================================================; PIN Definations;==========================================================lcddatabus equ P2 ;LCD Data Buslcdrs equ P0.7 ;LCD RSlcden equ P0.6 ;LCD ENadc_data_bus equ P1adc_add_a equ P3.3adc_add_b equ P3.4adc_ale_soc equ P3.5adc_eoc equ P3.6adc_oe equ P3.7buzzer equ P0.1;==========================================================; Register & Memory Definations;==========================================================Reg_pc_int equ 34hspeed equ 35hhex2asc_R0 equ 36hhex2asc_R1 equ 37hhex2asc_R2 equ 38hhex2asc_R3 equ 39hLcd_reg equ 45hdelreg1 equ 46hdelreg2 equ 47hdelreg3 equ 48hLCD_cursor_R1 equ 3AhLCD_cursor_R2 equ 3BhLCD_cursor_R3 equ 3Chadc_op_temp equ 41h ;channel 0adc_op_humid equ 43h ;channel 2adc_op_light equ 44h ;channel 2;================================================================org 0000hcall initloop: call adc_tempcall adc_humiditycall adc_lightcall disp_valuescall temp_ctrlcall delay1_5secjmp loop;=============================================================;subroutines start from here;=============================================================adc_temp: clr adc_add_b ;Channel 0 (Temp) is selectedclr adc_add_asetb adc_ale_soc ;ale & soc is made highclr adc_ale_soc ;ale & socis made lowjnb adc_eoc,$ ;check for eocsetb adc_oe ;if eoc high,make oe highmov a,adc_data_bus ;Read port0 data to accmov adc_op_temp,a ;Copy data in Registerclr adc_oe ;make oe lowmov a,adc_op_tempret;=============================================================adc_humidity: clr adc_add_b ; Channel 1(Humidity) is selectedsetb adc_add_asetb adc_ale_soc ;ale & soc is made highclr adc_ale_soc ;ale & socis made lowjnb adc_eoc,$ ;check for eocsetb adc_oe ;if eoc high,make oe highmov a,adc_data_bus ;Read port0 data to accmov adc_op_humid,a ;Copy this data in Registerclr adc_oe ;make oe lowadc_hum_ret: ret;=============================================================adc_light: setb adc_add_b ; Channel 2(Light) is selectedclr adc_add_asetb adc_ale_soc ;ale & soc is made highclr adc_ale_soc ;ale & socis made lowjb adc_eoc,$ ;check for eocjnb adc_eoc,$ ;check for eocsetb adc_oe ;if eoc high,make oe highmov a,adc_data_bus ;Read port0 data to accmov adc_op_light,a ;Copy this data in Registerclr adc_oe ;make oe lowadc_light_ret: ret;=============================================================disp_values:mov sbuf,#’T’jnb ti,$clr timov sbuf,#’E’jnb ti,$clr timov sbuf,#’M’jnb ti,$clr timov sbuf,#’P’jnb ti,$clr timov sbuf,#’.’jnb ti,$clr timov sbuf,#’=’jnb ti,$clr timov hex2asc_R0,adc_op_tempcall disp_hex2ascmov sbuf,#0dfhjnb ti,$clr timov sbuf,#’c’jnb ti,$clr timov sbuf,#’ ‘jnb ti,$clr timov sbuf,#’H’jnb ti,$clr timov sbuf,#’U’jnb ti,$clr timov sbuf,#’M’jnb ti,$clr timov sbuf,#’D’jnb ti,$clr timov sbuf,#’I’jnb ti,$clr timov sbuf,#’T’jnb ti,$clr timov sbuf,#’Y’jnb ti,$clr timov sbuf,#’=’jnb ti,$clr timov hex2asc_R0,adc_op_humidcall disp_hex2ascmov sbuf,#’%’jnb ti,$clr timov sbuf,#’R’jnb ti,$clr timov sbuf,#’H’jnb ti,$clr timov sbuf,#’ ‘jnb ti,$clr timov sbuf,#’L’jnb ti,$clr timov sbuf,#’I’jnb ti,$clr timov sbuf,#’G’jnb ti,$clr timov sbuf,#’H’jnb ti,$clr timov sbuf,#’T’jnb ti,$clr timov sbuf,#’=’jnb ti,$clr timov hex2asc_R0,adc_op_lightcall disp_hex2ascmov sbuf,#’0′jnb ti,$clr timov sbuf,#’L’jnb ti,$clr timov sbuf,#’U’jnb ti,$clr timov sbuf,#’X’jnb ti,$clr tiret;=============================================================disp_hex2asc: mov a,hex2asc_R0mov b,#100div abmov hex2asc_R1,amov a,bmov b,#10div abmov hex2asc_R2,amov a,bmov hex2asc_R3,amov lcddatabus,LCD_cursor_R1call lcdcmdmov lcddatabus,hex2asc_R1call lcddatamov a,hex2asc_R1mov sbuf,ajnb ti,$clr timov lcddatabus,LCD_cursor_R2call lcdcmdmov lcddatabus,hex2asc_R2call lcddatamov a,hex2asc_R2mov sbuf,ajnb ti,$clr timov lcddatabus,LCD_cursor_R3call lcdcmdmov lcddatabus,hex2asc_R3call lcddatamov a,hex2asc_R3mov sbuf,ajnb ti,$clr tiret;=============================================================temp_ctrl:mov a,adc_op_tempclr csubb a,#35jnc buzzer_offsetb buzzermov dptr,#tempincrcall pc_inttemp_ctrl_ret1: retbuzzer_off:clr buzzermov dptr,#tempdecrcall pc_inttemp_ctrl_ret2: ret;=============================================================init:call lcdinitmov scon,#50hmov tmod,#21hmov th1,#0FAhmov tl1,#0FAhsetb tr1mov dptr,#lcddispvalcall lcddispret;================================================================lcdinit:mov lcddatabus,#38hcall lcdcmdmov lcddatabus,#0chcall lcdcmdmov lcddatabus,#01hcall lcdcmdmov lcddatabus,#06hcall lcdcmdret;=============================================================lcdcmd: clr lcdrssetb lcdenclr lcdencall lcddelayret;=============================================================lcddata: setb lcdrssetb lcdenclr lcdencall lcddelayret;=============================================================lcddelay: mov delreg1,#08 ;LCDlcddelay1: mov delreg2,#250djnz delreg2,$djnz delreg1,lcddelay1ret;=============================================================lcddisp: mov lcddatabus,#01hcall lcdcmdlcddisp2: mov a,lcd_regmovc a,@a+dptrcjne a,#’$’,lcddisp1mov lcddatabus,#0c0hcall lcdcmdjmp lcddisp2lcddisp1: cjne a,#’@’,lcddisp3retlcddisp3: mov lcddatabus,acall lcddatajmp lcddisp2;=============================================================delay1_5sec: mov delreg1,#15delay1_5sec1: mov delreg2,#200delay1_5sec2: mov delreg3,#250djnz delreg1,$djnz delreg2,delay1_5sec2djnz delreg3,delay1_5sec1ret;=============================================================; PC INTERFACING;=============================================================pc_int: mov a,Reg_pc_intmovc a,@a+dptrcjne a,#’$’,pc_int1mov a,#’ ‘mov sbuf,ajnb ti,$clr tijmp pc_intpc_int1: cjne a,#’@’,pc_int3mov a,#10mov sbuf,ajnb ti,$clr timov a,#13mov sbuf,ajnb ti,$clr tiretpc_int3: mov sbuf,ajnb ti,$clr tijmp pc_int;=============================================================lcddispval: db “T= “,0dfh,”c H= %RH@L= 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 valuePlease help me in correcting/rectifying errorsin the above code to work with the following circuit DesignJanuary 2, 2012 at 1:29 am #6973Gangaram
ParticipantPlease 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
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.