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.

LM35 thermostat code ??????????

Status
Not open for further replies.

abdulQ8

Newbie level 4
Joined
Feb 22, 2009
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,312
lm35 thermostat

I Use in my project LM35 and I want to design thermostat that if Temp >44 the DC motor on
and i write my code but i want some one to help me cause i think there is problem is ADC and the range of LM35 (how to present 44C in the program )
I uses attiny26 ,LM35 and DC motor
and this is my code (winAVR)

#define F_CPU 8000000L
#include <avr/pgmspace.h>
#include <avr/io.h>
#define setbit(port, bit) (port) |= (1 << (bit))
#define clearbit(port, bit) (port) &= ~(1 << (bit))
int main()
{
{
unsigned char x;
unsigned int result,temp;
DDRA = 0xff;
DDRB=0;
ADMUX = 0b00100111; // chan 7, left adjusted, [ref=AVCC]
ADCSR = 0b10000111; // ADC enabled,ADC interrupt enabled,
//prescalar=64 ->ADC frequency 125 kHz
while (1){
setbit(ADCSR, 6); // start conversion. can also be written ADCSR= [ADCSR | 0x40];
do {
x = ADCSR & 0x10;
}while (x == 0); // repeat until EOC
PORTA = ADCH;
}
temp=ADCH;
if(temp>44)
PortA=0xf;
else
portA=0;

return o;
}

if some one knows the write code please tell me as possible as you can
 

lm35dz thermostat

I am working on a sort of same project that is an automatic temperature control and i have almost completed its software. But i m using 8051 and you are avr.
 

thermostat lm35

send me your code please
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top