Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Digital Thermometer PLEASE HELP

Status
Not open for further replies.

jhunt315

Junior Member level 1
Joined
Dec 2, 2010
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,408
I need a schematic of a digital thermometer, i am using an LM34 sensor and a PIC16F917 microcontroller hooked up to a seven segment display. Does anyone have one?
 

ckshivaram

Advanced Member level 5
Joined
Apr 21, 2008
Messages
5,070
Helped
2,149
Reputation
4,304
Reaction score
2,089
Trophy points
1,393
Location
villingen (Germany) / Bangalore
Activity points
30,097
check this
Nigel's PIC Tutorial Page
Multiplexed Seven Segment Display using PIC16F877A and HI-TECH C | eXtreme Electronics

Code:
#include <pic.h>

#define	DIGIT1	RA0	
#define	DIGIT2	RA1	
#define 	DIGIT3	RA2	
#define	ON			0
#define	OFF		1

/* 
RA5 - Segment a
RC5 - Segment b
RC4 - Segment c
RC3 - Segment d
RC2 - Segment e
RC1 - Segment f
RC0 - Segment g

RA4 - Thermistor
*/

__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT \
  & UNPROTECT & BORDIS & IESODIS & FCMDIS);
  
  
const char LEDDigit[10] = {
    0b0000001,                  //  Digit Zero
    0b1001111,                  //  Digit One
    0b0010010,                  //  Digit Two
    0b0000110,                  //  Digit Three
    0b1001100,                  //  Digit Four
    0b0100100,                  //  Digit Five
    0b0100000,                  //  Digit Six
    0b0001111,                  //  Digit Seven
    0b0000000,                  //  Digit Eight
    0b0000100};                 //  Digit Nine
    
  
int Temperature, TempDigit, DisplayPos, D1, j;
int ADCState;

int i, j, d, t, temp;
main()
{
	///////////  INIT  ////////////
	
	PORTA = 0;
	PORTC = 0;
	TRISA = 0b010000;      		//  All Bits of PORTA are Outputs except RA4
   TRISC = 0;           		//  All Bits of PORTC are Outputs
   
   CMCON0 = 7;                //  Turn off Comparators
   ANSEL = 1 << 4;            //  RA4 is ADC input
   ADCON0 = 0b00001101;			//  Left justify, Use Vdd, Channel 4 (AN3), Do not start, Turn on
   ADCON1 = 0b00010000;			//  run oscillatr as 8 x prescalar
   
   DisplayPos = 0;
   j = 0;
   Temperature = 0;
   ADCState = 0;

  
   ////  MAIN LOOP  ////
   
   while(1)
   {
	   ///////////  DISPLAY READOUT  ///////////
	   
	   DIGIT1 = OFF;
	   DIGIT2 = OFF;
	   DIGIT3 = OFF;
	   
		if(DisplayPos == 0)									//Light 1st segment
		{
			TempDigit = Temperature % 10;					//Just get "1"s place
			RA5 = LEDDigit[TempDigit] >> 6;				//Turn on digit
			PORTC = LEDDigit[TempDigit];
			DIGIT3 = ON;
			for(D1=0;D1<414;D1++);							//Delay for 7ms
			
		}else if(DisplayPos == 1)							//Light 2nd segment
		{
			TempDigit = Temperature % 100;				//Just get "10"s place (strip off "100"s place)
			TempDigit = TempDigit / 10;					//   and convert to "1"s place
			RA5 = LEDDigit[TempDigit] >> 6;				//Turn on digit
			PORTC = LEDDigit[TempDigit];
			DIGIT2 = ON;
			for(D1=0;D1<400;D1++);							//Delay for 7ms
		}else														//Light 3rd segment
		{	
			TempDigit = Temperature / 100;				//Just get "100"s place
			RA5 = LEDDigit[TempDigit] >> 6;				//Turn on digit
			PORTC = LEDDigit[TempDigit];
			DIGIT1 = ON;
			for(D1=0;D1<400;D1++);							//Delay for 7ms
		}

		DisplayPos = (DisplayPos + 1) % 3;				//Next segment
		
		
		j++;
		if(j == 50)												//Time to update temp?
		{
			j = 0;
		
			switch(ADCState)
			{
				case 0:						//Start ADC operation
					GODONE = 1;
					ADCState = 1;
					break;
				case 1:
					ADCState = 0;
					Temperature = ADRESH - 82;
					break;
			}
		}
	}
}
 

jhunt315

Junior Member level 1
Joined
Dec 2, 2010
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,408
I am using 3 seven segment displays. ckshivaram, that code seems like it is exactly what i need to make my thermometer work. Do you by any chance have a schematic i can use to hook everything up? I tried hooking something up and my temperature sensor is heating up extremely quickly and burning out so i have to try something different.
 

samson A.

Member level 3
Joined
May 15, 2009
Messages
58
Helped
10
Reputation
20
Reaction score
10
Trophy points
1,288
Location
Lagos, Nigeria
Activity points
1,642
You are not gonna quit that because you dont know how to connect the sensor. Get the sensor data sheet and lookup its spec.
 

manogeg

Newbie level 2
Joined
Nov 6, 2008
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,291
see the link Exploring the Embedded Technology......... A SCHEMATIC OF DIGITAL THERMOMETER USING LM 35 AND 877A IS THERE. LM 34 IS FAHRENHEIT DETECTOR.IT GENERATES 10mV FOR 1 DEGREE FAHRENHEIT.That is for tEMP OF 30 DEGREE CELCIUS ,EQUIVALENT FAHRENHEIT IS AROUND 100 AND SO THE SENSOR OUTPUT VOLTAGE IS SOMETHING AROUND 1 V.WHATS THE PACKAGE U USED.AND U NEED TO CONNECT THE O/P TERMINAL TO THE ADC INPUT.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top