The firmware for this project is developed with MikroC Pro for AVR 5.00 compiler. The program is very simple and straight. There are six function other than the main function. These are described below briefly:
- void setup_MCU() This function setups the micros peripherals for optimum operation by setting up individual buil-in peripheral registers and library function of the MikroC for AVR compiler. In this case the ADC and LCD libraries are used.
- void display_common() This function simply displays the texts “Temperature” and “Relative Humidity” along with their units. Since there is only one screen, it’s called only once.
- float read_voltage(unsigned short channel) This function read the ADC channel specified to it and takes the average of 64 ADC samples. This helps to reduce noisy A/D inputs and enhance precision. The result after doing all the maths is returned to the calling function.
- float read_humidity() and float read_temperature() These compute relative humidity and temperature data using their equations and ADC data, and prepare for display.
- void display_data(unsigned char x, unsigned char y, float value) This function specifies the location of the display and what to show from the acquired data.
Source Code and HEX files of this project - download