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.

thermostat with relay

Status
Not open for further replies.

kavindu

Newbie level 1
Joined
Jun 8, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,296
Hi All,
I am new to PIC programming. I programme a thermostat using LM35. Now I want to update it with a relay which have a adjustable setpoint. I mean If I need a relay output at 25 C I can adjust it so.
IF I need it at 23C It should be at there.
I have RC2 & RC3 as input (push buttons) and RC5 as output in 16F876A in my hardwere.
This is my code for thermostat.

PLS............... Help me........ my code is compile. Ineed it to be update with a output relay output. I mean It shows temparature but not relay output. I need it with a adjustable relay setpoint.


/**************************************************************
THERMOMETER WITH LM35 & LCD DISPLAY
====================================



Date: July 2011
File: LM35.C
**************************************************************/
//
// Start of MAIN Program. Configure LCD and A/D converter
//
void main()
{
unsigned long Vin,tmp;
char * ch ="00.0";
TRISB = 0; // PORTC are outputs (LCD)
TRISA = 0xFF; // PORTA is input
//
// Configure LCD
//
Lcd_Init(&PORTB); // LCD is connected to PORTC
Lcd_Cmd(LCD_CLEAR);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Out(1,3,"THERMO METER");
Delay_ms(500); // delay
ADCON1 = 0x80; // Use AN0 and Vref=+5V
//
//
// Program loop
//
for(;;) // Endless loop
{

Lcd_Cmd(LCD_CURSOR_OFF);
Vin = Adc_Read(0); //read ADC(0)
tmp = Vin/2 ;
ch[0] = (tmp / 10 + 48) ; //Calculate fractional part
ch[1] = (tmp % 10 + 48) ;
Lcd_Chr(2,11,223);
Lcd_Chr(2,12,'C');
Lcd_out(2,7,ch);
Delay_ms(500); // Wait 1 second
}
}
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top