Tuesday, September 1, 2020

ATMega32 Interfaces To LM35 And 16x2 Character LCD

Overview

In some previous post, I have wrote some posts about analog to digital convert. This peripheral converts any analog output devices and converter them to digital value. Some analog output sensor like LM35 creates an analog voltage output linear to its 10 mV step temperature value.

A display device show the information or status of the MCU and other input output devices. I posted some examples on using the industrial standard HD44780 LCD controller.

ATMega32 Interfaces To LM35 And 16x2 Character LCD
Example Program

In this example post, ATMega32 reads the analog temperature value and just display this information to the display. The temperature is in both degree Celsius and degree Fahrenheit.

Interfacing And Programming

LM35 connects to the analog input pin ADC7 - the user could select any analog pin within its 8 analog inputs. The MCU clocks at 16 MHz due to a pre-soldered crystal on the learning board. However, I set the ADC conversion clock rate to 1:128.

ATMega32 Interfaces To LM35 And 16x2 Character LCD
LM35DZ in TO-92 Package

The display operates in 4-bit interfacing mode. A single PORTD of the MCU is sufficient to do this task.

ATMega32 Interfaces To LM35 And 16x2 Character LCD
Schematic Diagram

C source code of this example lists below, click here to download a zip archive.

Note: Without configuring the sprintf() function in the project property, it can't convert the float data type to string value. We must the project properties as follow.
  1. Open the project properties by pressing ALT+F7. 
Tick the required tick box as shown in the picture

  1. Fill the required link flag
Fill the text box with this string "-lprintf_flt"

Then we can use the sprintf() function with float data type properly. If you still have the problem with sprintf(), see this link because I got it work from there.

No comments:

Post a Comment

Search This Blog

Labels

25AA010A (1) 8051 (7) 93AA46B (1) ADC (30) Analog Comparator (1) Arduino (15) ARM (6) AT89C52 (7) ATMega32 (56) AVR (57) CCS PICC (28) DAC (1) DHT11 (2) Display (105) Distance Sensor (3) DS18B20 (3) dsPIC (2) dsPIC30F1010 (2) EEPROM (5) Environment Sensor (4) esp8266 (1) I2C (29) Input/Output (67) Interrupt (19) Keil (5) Keypad (10) LCD (47) Master/Slave (1) MAX7221 (1) MCP23017 (5) MCP23S17 (4) Meter (3) MikroC (2) Motor (15) MPLABX (71) Nokia 5110 LCD (3) OLED (2) One-Wire (6) Oscillator (8) PCB (6) PCD8544 (3) PCF8574 (5) PIC (107) PIC12F (2) PIC16F628A (2) PIC16F630 (1) PIC16F716 (3) PIC16F818 (10) PIC16F818/819 (2) PIC16F84A (15) PIC16F876A (1) PIC16F877A (9) PIC16F88 (1) PIC16F887 (60) PIC18 (19) PIC18F1220 (4) PIC18F2550 (3) PIC18F4550 (12) PWM (11) RTC (8) Sensor (10) SH1106 (1) Shift Register (11) Shift Registers (3) SPI (24) STM32 (6) STM32 Blue Pill (6) STM32CubeIDE (6) STM32F103C8T6 (6) SysTick (3) temperature sensor (11) Thermometer (21) Timer/Counter (31) TM1637 (2) UART (7) Ultrasonic (4) Voltmeter (7) WDT (1) XC16 (2) XC8 (94)