C and Assembly Code For 8051 Based Temperarture Monitoring System
C and Assembly Code For 8051 Based Temperarture Monitoring System
Monitoring System
INTRODUCTION :
Ladies and Gentlemen, way back couple of weeks I posted a working model for 8051/8052
based temperature monitoring system. The C and Assembly Code was in the pending
tray. Please note that the monitoring system includes LCD, the programming for which had
also been integrated below. In fact this is the whole program for complete temperature
monitoring system. The subject coding for microcontroller 8051 is discussed with sufficient
comments below. Moreover if you find any difficulty regarding the coding or the the
description, you are more than welcome to contact the owner of this term project
at jamalel640@hotmail.com.
CODE :
;PROGRAMER: JAMAL
;BATCH : 2007
;************************************************************************
**************
;........DEFINING VARIABLES..........
ORG 0000H
;************************************************************************
**************
;................MAIN PROGRAM.......................
CLR EN_LCD ; make en=0
CALL SEND_HEX_TO_DEC
SJMP HERE
;************************************************************************
**************
STRING_ROUTINE:
INC STR_PTR_ADC
MOV A,STR_PTR_ADC
JMP EXIT_LCD_MSG
CLR EN_LCD
CALL WAIT_LCD
JMP STRING_ROUTINE
EXIT_LCD_MSG:
RET
;************************************************************************
**************
DIV AB
MOV R6,B
MOV R5,A
CALL DISPLAY
BACK:
RET
DIV AB
MOV R3,A
CALL WR_LCD_COMMAND
CALL WAIT_LCD
MOV A,R3
ADD A,#30H
MOV A,B
MOV A,#'C'
CALL WR_LCD_DATA
JMP BACK
CALL WR_LCD_COMMAND
CALL WAIT_LCD
ADD A,#30H
CALL WR_LCD_DATA
mov A,R6
ADD A,#30H
CALL WR_LCD_DATA
ADD A,#30H
CALL WR_LCD_DATA
MOV A,#'C'
CALL WR_LCD_DATA
RET
;************************************************************************
**************
DJNZ R0,AGAIN
CALL WAIT_LCD
CALL WAIT_LCD
CALL WR_LCD_COMMAND
CALL WAIT_LCD
RET
;************************************************************************
**************
CLR EN_LCD
RET
;************************************************************************
**************
;..........ROUTINE FOR SENDING DATA TO LCD..................
CLR EN_LCD
CALL WAIT_LCD
RET
;************************************************************************
**************
CLR EN_LCD
CLR RS_LCD
SETB RW_LCD
SETB EN_LCD
MOV A,OUTPUT_LCD
JB ACC.7,WAIT_LCD
ret
;************************************************************************
*************
ORG 100H
;************************************************************************
*************
SETB INTR_ADC
CLR CS_ADC
SETB RD_ADC
CLR WR_ADC
SETB WR_ADC
JB INTR_ADC,$
CLR RD_ADC
NOP
SETB CS_ADC
RET
;************************************************************************
*************