Ajantha College and School Students Science Projects materials The Great in project

"In the name of Allah, most
Gracious, most Compassionate"


044 4213 1795


+91 91764 16648   +91 9042 686793

Archive for the ‘101-Announcements’ Category

Digital thermometer using 8051

Thermometer using 8051.

This article is about a simple 0-100°C digital thermometer with 1°C resolution using 8051. The circuit is based on LM35 analog temperature sensor, ADC0804 and AT89S51 microcontroller. LM35 is an analogue temperature sensor IC which can measure a temperature range of -55 to 150°C. Its output voltage varies 10mV per °C change in temperature. For example, if the temperature is 32°C, the output voltage will be 32 x 10mV = 320mV. ADC 0804 is used to convert the analogue output voltage of the LM35 to a proportional 8 bit digital value suitable for the microcontroller. The microcontroller accepts the output of ADC, performs necessary manipulations on it and displays it numerically on a 2 digit seven segment LED display. Out put of the LM35 is connected to the +Vin (pin 6) of the ADC0804. Resistor R13 and preset R14 is used to provide an external reference voltage of 1.28V to the Vref/2 pin ( pin 9) of the ADC0804 and with this reference voltage, the step size of the ADC will be 10mV and span will be 0-1 V. This means that for a 10mV input the digital out of ADC will be 1 (1 in decimal also), for 20mV it will be 10 (2 in decimal), for 30mV it will be 11 (3 in decimal) and so on. The microcontroller accepts this data and puts it on the seven segment display.

Circuit diagram.

Taking Down Forums in CircuitsToday


MOV P1,#11111111B   // initializes P1 as input port
MOV P0,#00000000B   // initializes P0 as output port
MOV P3,#00000000B   // initializes P3 as output port
MOV DPTR,#LABEL     // loads the address of "LABEL" to DPTR
MAIN: MOV R4,#250D  // loads register R4 with 250D
      CLR P3.7      // makes Cs=0
      SETB P3.6     // makes RD high
      CLR P3.5      // makes WR low
      SETB P3.5     // low to high pulse to WR for starting conversion
WAIT: JB P3.4,WAIT  // polls until INTR=0
      CLR P3.7      // ensures CS=0
      CLR P3.6      // high to low pulse to RD for reading the data from ADC
      MOV A,P1      // moves the digital output of ADC to accumulator A
      MOV B,#10D    // load B with 10D
      DIV AB        // divides the content of A with that in B
      MOV R6,A      // moves the quotient to R6
      MOV R7,B      // moves the remainder to R7
DLOOP:SETB P3.2     // sets P3.2 which activates LED segment 1
      MOV A,R6      // moves the quotient to A
      ACALL DISPLAY // calls DISPLAY subroutine
      MOV P0,A      // moves the content of A to P0
      ACALL DELAY   // calls the DELAY subroutine
      CLR A         // clears A
      MOV A,R7      // moves the remainder to A
      CLR P3.2      // deactivates LED segment 1
      SETB P3.1     // activates LED segment 2
      MOV P0,A
      CLR A
      CLR P3.1      // deactivates LED segment 2
      DJNZ R4,DLOOP // repeats the loop "DLOOP" until R4=0
      SJMP MAIN     // jumps back to the main loop
DELAY: MOV R3,#255D // produces around 0.8mS delay
DISPLAY: MOVC A,@A+DPTR // converts A's content to corresponding digit drive pattern
LABEL: DB 3FH       // LUT (look up table) starts here
       DB 06H
       DB 5BH
       DB 4FH
       DB 66H
       DB 6DH
       DB 7DH
       DB 07H
       DB 7FH
       DB 6FH