Iana Bancila
Newbie level 3
- Joined
- Dec 2, 2014
- Messages
- 3
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 26
Hi all, I'm new on this field, and if someone can help me to simulate Digital thermostat
Develop a thermostat (embedded system maintaining a specific temperature):
-> Input: Temperature (as voltage reference, from 0 to VCC - use ADC) (it's up to you to set the
correspondence of 0..Vcc to real-life Celsius temperature, recommended -- 0..99, but not mandatory)
-> Input: Desired temperature, set by a button labelled "+" and a button labelled "-"
-> Output: 0 or 1 to a pin, outputting to a resistor (emulating a heating element)
-> Output: Desired temperature as a three-digit number (shown on 7-seg or 8-seg displays)
Tips:
For setting a certain voltage level:
Use a variable resistor (prefer the ones from the ACTIVE library of the Resistor component type),
connect one pin to power, one pin to ground, and the middle pin to the controller.
Don't forget to set data direction registers (DDR or PxSEL): input for ADC, output for the heating
element.
ADC:
Refer to the user guide of specific controller for details.
1) ADMUX register to set the desired source and voltage reference (AREF is recommended -- connect
it to Vcc in Proteus)
2) ADCSRA: ADEN to enable ADC, ADSC to start conversion, ADIE to enable the interrupt,
ADPS[2:0] to set prescaler (not so important, since we don't have time issues)
3) SFIOR: relevant only if you set the ADATE bit in ADCSRA to 1, meaning there is a specific trigger
to start a conversion
4) Read from ADCH and ADCL (resolution is 10 bits, AVR is on 8 bits, so two registers are needed --ADLAR specifies which way it's adjusted)
Writing an interrupt:
Develop a thermostat (embedded system maintaining a specific temperature):
-> Input: Temperature (as voltage reference, from 0 to VCC - use ADC) (it's up to you to set the
correspondence of 0..Vcc to real-life Celsius temperature, recommended -- 0..99, but not mandatory)
-> Input: Desired temperature, set by a button labelled "+" and a button labelled "-"
-> Output: 0 or 1 to a pin, outputting to a resistor (emulating a heating element)
-> Output: Desired temperature as a three-digit number (shown on 7-seg or 8-seg displays)
Tips:
For setting a certain voltage level:
Use a variable resistor (prefer the ones from the ACTIVE library of the Resistor component type),
connect one pin to power, one pin to ground, and the middle pin to the controller.
Don't forget to set data direction registers (DDR or PxSEL): input for ADC, output for the heating
element.
ADC:
Refer to the user guide of specific controller for details.
1) ADMUX register to set the desired source and voltage reference (AREF is recommended -- connect
it to Vcc in Proteus)
2) ADCSRA: ADEN to enable ADC, ADSC to start conversion, ADIE to enable the interrupt,
ADPS[2:0] to set prescaler (not so important, since we don't have time issues)
3) SFIOR: relevant only if you set the ADATE bit in ADCSRA to 1, meaning there is a specific trigger
to start a conversion
4) Read from ADCH and ADCL (resolution is 10 bits, AVR is on 8 bits, so two registers are needed --ADLAR specifies which way it's adjusted)
Writing an interrupt: