Wednesday 15 June 2011

LCD interfacing with Atmega32


LCD is most common hardware for displaying data and second most common debugging tool after LED's. In this blog a simple counter will be implemented on a LCD interfaced with Atmega32.

The simple schematic diagram

The Bx shows that the LCD header is interfaced with PORTB. AVR-GCC does not have inbuilt headers for LCD display. To make the work easy the LCD header LCD.h is posted below.

To use this header put the LCD.h file in include directory under AVR installation. For example in my case
its /usr/avr/include.

If your LCD is connected to PORTX then replace PORTB with PORTX where X is the port on which the LCD is interfaced.

The program for the counter implementation

The sprintf function stores the string "%d" in the array temp. Thus sprintf can be useful in such cases where the string is dynamically changing.


No comments:

Post a Comment

Popular Posts