Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics 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.

Temperature controller PIC16f877 need some modify

Status
Not open for further replies.

maxim10373

Advanced Member level 4
Joined
Feb 26, 2010
Messages
115
Helped
1
Reputation
2
Reaction score
2
Trophy points
1,298
Activity points
2,063
Dear ..
I attached here with the c-file and circuit and the working principle is given below;
Set any minimum and maximum temperature with the help of LCD display, by pressing switches S2 and S3. The maximum temperature will start from minimum temperature +10 degrees. If the temperature being measured is more than the preset maximum temperature, relay RL1 de-energises and the heating element is switched off. Similarly, when the measured temperature goes below the preset minimum temperature, relay RL1 is energised and the heating element is turned on.

here I need to some modification of the program please help.

1) Normally switched on the heating element and switched off when reached the set temperature (set by S3)
Don't restart temperature goes below.
2) display set temperature show on LCD screen

please help me is very urgent

maxim
 

Attachments

  • Tempr.rar
    622 bytes · Views: 46
  • 772_Fig-2.jpg
    772_Fig-2.jpg
    238.2 KB · Views: 64
Last edited:

I could not distinguish on the whole above explanation, what is the problem. Show what you've made so far to achieve what you need to do, and what is not working as expected. And please, add source codes at the post, not attachments.

BTW: You did not provide any code, just a bare project file.
 
Sir
This project is working well. But need some changes according to my application.
In this circuit Heating element Off and On similarly when the temperature greater than set temperature and
less than the set temperature.In my application, I need only one command which is;
"If the measured temperature greater than set temperature the heating element switched off" (or on depend relay pins)
I don't want the other function" Less than the set temperature system start automatically.
is it possible to any changes in program ?

Regards
maxim

- - - Updated - - -
Code:
#include <pic.h>
#include <math.h>
#include "lcd.h"
void delay(unsigned int time) // Delay 
{
	unsigned int i, j;
	for(i=0;i<time;i++)
	   for(j=0;j<time;j++); 
}

void main(void)
{	unsigned int result,temp,unit,a,b,c,d,x,y,z;
	x = 0;
	y = 0;
	TRISA = 1;    		// AN0 ADC channel as input 
	TRISB = 0;			// port B as output
	TRISC = 7;			// port C is  used for switches and relay
	TRISD = 0;			// port D as output
	ADRESH = 0;
	ADRESL = 0;
	ADCON0 = 0x01;		// Fosc/4, channel AN0, ADC is ON.
	ADCON1 = 0xCE;		// Right justified (last 2 bit in ADRESH and first 8 bit in ADRESL ), AN0 is analog.
	lcdint();			// intialised LCD
	cmm(0x01);			// clear display
	cmm(0x80);			// 1'st line of LCD
	data_str("TEMP.INDICATOR");
	
while(1)
{  
  if (RC0 == 1)		//Low Temperature setting
		  {
	 	   x++;
	 	 if(x>999)
	 	  {
	        x=000;
	        delay(20);
	      }
		     z = x + 10;	// used for high value setting
	 		 y = z;
	 		 cmm(0xC0);
	 		 data_str("MIN. : ");
             unit = x; 		// Temperature is conveted to ASCII
	 		 temp = unit%10;
	 		 a = temp+48;
			 temp = unit/10;
	 		 temp = temp%10;
 	 		 b = temp+48;
			 temp = unit/10;
			 temp = temp/10;
			 temp = temp%10;
			 c = temp+48;
			 temp = unit/10;
			 temp = temp/10;
			 temp = temp/10;
			 d = temp+48;
			 delay(10);
   			 cmm(0xC8);			// Temperature display on LCD.
			 dat(d);
			 cmm(0xC9);
			 dat(c);
			 cmm(0xCA);
			 dat(b);
			 cmm(0xCB);
			 dat(a);
			 delay(10);
		}
		else if (RC1 == 1)		//High Temperature setting
	{	y = y + 1;
	 if(y>999)
	 	{
	  	 y=z;
	     delay(20);
	 	}
	 cmm(0xC0);
	 data_str("MAX. : ");
     unit = y; 		// Temperature is conveted to ASCII
	 temp = unit%10;
	 a = temp+48;
	 temp = unit/10;
	 temp = temp%10;
 	 b = temp+48;
     temp = unit/10;
	 temp = temp/10;
	 temp = temp%10;
	 c = temp+48;
	 temp = unit/10;
	 temp = temp/10;
	 temp = temp/10;
	 d = temp+48;
	 delay(10);
     cmm(0xC8);			// Temperature display on LCD.
	 dat(d);
	 cmm(0xC9);
	 dat(c);
	 cmm(0xCA);
	 dat(b);
	 cmm(0xCB);
	 dat(a);
	 delay(10);
    }

			else 
				{ 
			    	while (RC2 == 1)	// Key close for ADC and control the heater	
	 					{ 

						 cmm(0xC0);		// 2nd line of LCD
	 					 data_str("TEMP : ");
						 ADGO = 1;			//start conversion 
					  	 while(ADGO == 1)	// wait for conversion is finish
  							{	
						 	 result = 256 * ADRESH + ADRESL; //Get temperature
						  	 delay(10);
   							 unit = result*5000/1023; 		// Temperature is conveted to ASCII
							 temp = unit%10;
							 a = temp+48;
						  	 temp = unit/10;
	 						 temp = temp%10;
							 b = temp+48;
	 						 temp = unit/10;
						 	 temp = temp/10;
							 temp = temp%10;
							 c = temp+48;
							 temp = unit/10;
							 temp = temp/10;
							 temp = temp/10;
							 d = temp+48;
							 delay(10);
    						 cmm(0xC8);			// Temperature display on LCD.
							 dat(d);
							 cmm(0xC9);
							 dat(c);
							 cmm(0xCA);
							 dat(b);
							 cmm(0xCB);
							 dat(a);
						  	 delay(100);
  							}  
							if(result>y)RC3 = 0;
							if(result<x)RC3 = 1;
						 }
					  }
}
}
 

Attachments

  • Therm1.c.txt
    3.2 KB · Views: 46
Last edited by a moderator:

Perhaps, removing the while (RC2 == 1) evaluation ?
I mean, do not bind the heating control process upon a key press anymore.
 
I Will not modify the project instead I will write a new code for you. I was not able to understand your requirement. You say it is urgent then please explain how the project is working now and then explain how you want it to work.

I need 2 hours to write the code.
 

Set any minimum and maximum temperature with the help of LCD display, by pressing switches S2 and S3. The maximum temperature will start from minimum temperature +10 degrees. If the temperature being measured is more than the preset maximum temperature, relay RL1 de-energises and the heating element is switched off. Similarly, when the measured temperature goes below the preset minimum temperature, relay RL1 is energised and the heating element is turned on.
This is the present condition.
And my requirement is;
1) Set any temperature with the help of switch S3, when reach the set temperature, relay RL1 de-energises and heating element switched of.
2) After reset the set value with the help of switch S1 manually (by hand)and repeat the function.
3) LCD show the temperature up to which we set.
This three function only I need. I can not change the hardware because I already made.

Thanks for reply and waiting ..
regards
maxim
 

Yes, two buttons are used to set the temperature but does it use floating point to increase or decrease temperature value settings ? Or does it increment or decrement in steps of 1 degree C ?
 

Do you want code for exact circuit ? If yes, then I will write new code and post it by tomorrow.
 

If possible I can use S2 Increase,S3 decrease and S4 set

- - - Updated - - -

yes.I will wait till tomorrow.

Thank you very much sir
 

Ok. I will add one more button for SET. I will send you new circuit and code tomorrow.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top