Professional Documents
Culture Documents
Faculty of Electrical and Electronic Engineering 2020 - 2021
Faculty of Electrical and Electronic Engineering 2020 - 2021
Homework 6
2
CONTENTS
1. Abstract................................................................................................................3
2. Introduction.........................................................................................................3
3. Implement............................................................................................................4
3.1 In Proteus........................................................................................................4
3.2 in CodeVision AVR........................................................................................6
4. Result....................................................................................................................8
5. Conclusion............................................................................................................9
6. References............................................................................................................9
3
1. Abstract
This report introduces the basic background and study the thermistor by using
Proteus and CodeVision AVR.
2. Introduction
1 1
β− parameter equation : R = R0.e β .( T − ¿ ) (1)
4
3. Implement
3.1 In Proteus
5
Figure 2. Load hex file from AVR
6
3.2 in CodeVision AVR
7
Figure 5. Set up USART to use Virtual Terminal
#include <mega8.h>
#include <delay.h>
#include <math.h>
8
while (1)
{
// Place your code here
adc_value = read_adc(6);
Vin = (Vref * adc_value * 1.0f) / 1023;
x = adc_value * 1.0f / 1023;
NTC = (x * R1) / (1 - x);
y = log(NTC / R0);
ToK = 1 / ((y / beta) + (1.0f / T0)); //temperature in Kelvin
ToC = ToK - 273; //temperature in degree Celsius
printf("ADC value = %d; Vin = %f; Temp = %f \r\n", adc_value, Vin, ToC);
delay_ms(1000);
}
4. Result
T = 31 °C
T = 40 °C
9
T = 25 °C
5. Conclusion
In this report, we have tried to study the basic concept and how to use
Proteus and CodeVision AVR to simulate the operating way of Thermistor.
6. References
https://circuitdigest.com/microcontroller-projects/how-to-use-adc-in-avr-
microcontroller-atmega16
10