In addition to this, the relay should not directly be driven from the MCU I/O
pin. You need to drive it with a transistor. The easiest way to do that is to
have an NPN transistor supply the ground to the relay. You may also need a
flyback diode across the relay coil in order to prevent nasty spikes over the
transistor when the relay is de-energized (switched off).
/Ruben
> I'm gonna have to agree with some of the previous comments...
>
> You need to provide us with more information about what you need. Based on the
> things you've said, I would assume the following:
>
> 1) You know how to probe temps from the thermistor (If you can display temps on
> an LCD at will, you can probe the temperature at will...) 2) You have a relay
> hooked up correctly to the system (You said you had it hooked to a PB2). 3) The
> relay can be used to turn the heating system on or off. (You didn't really say
> this, but what else would I assume based on what you said?)
>
> If these 3 things are true, then the only advice I could give you is this...
>
> 1) Don't forget to set DDRB = 0xFF (or 0x04) to ensure that PB2 is defined as
> an output. 2) Review IF statements in C and learn to put design conditional
> statements in C. 3) You will need to utilize code that will be nearly identical
> to..
>
> if(temp<270){
> PORTB = PORTB|0x04; //Sets PB2 high (flips the relay)
> } else if(temp>280){
> PORTB = PORTB&0xFB; //Sets PB2 low (flips the relay)
> }
>
> Now, if those last three things helped you, great! But, if those last three
> things helped you...then one of the following is true...
>
> 1) You didn't attend class often enough (digital output and if statements are
> trivial and fundamental parts of programming micro controllers) 2) You attended
> but did not pay attention in class. (for the same reasons as above). 3) Your
> university offers the worst mechatronics course I've ever heard of (basically
> for the same reasons as above)
>
> Giving you the benefit of the doubt, hopefully none of those are true. Please
> define your problem a little more thoroughly for us...we really do want to help
> you.
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>
>
==============================
Ruben Jönsson
AB Liros Electronic
Box 9124, 200 39 Malmö, Sweden
TEL INT +46 40142078
FAX INT +46 40947388
ruben@...
==============================