Home
Links

Serial LCD Firmware

This project is firmware for using an AVR microcontroller to work as a serial output terminal from RS-232 input to output on a HD44780-compatible text LCD display. It is compatible and compiles with

  • AVR-GCC (WinAVR 200712)
  • Codevision 2.02.06
  • IAR 4.30 and 5.10
  • Imagecraft 7.16

The project is stored using the git version control system. The code can be obtained by

  • Downloading the latest zip file
  • Browse the git repository
  • Clone the git repository with the command
    git clone git://git.b9.com/avr_serial_lcd.git

From the current README file:

This is my version of AVR code to drive the Serial Backpack Project created by Carl W. Livingston. I've rewritten the original firmware to add a number of features, add compatibility for IAR and GCC, and well as create two different C++ version.

This project is also used to demonstrate how C code can be turned into C++ classes and to view the resulting differences in assembly output.

There are two versions of the C++ code: serial_lcd.cpp (which generates output files with the prefix serial_lcd_cpp) and serial_lcd_obj.cpp (generates output files with the prefix serial_lcd_obj).

The first C++ variant is designed to be equivalent to the C code in that the same inlining of functions were used. Also, the C++ classes were only to segment functions. No C++ class object contents member variables. The global variables in the C code remain global in the C++ code. Primarily, because these variables are stored in CPU and IO registers for greater efficiency. Other variables, like the UART circular buffer, remain in global memory space so its address is known at compile time and spare the address computation required if the variable was a member of a C++ object.

The second C++ variant uses classes that contain member variables and to which initialization parameters are sent. In this way, multiple objects of that class can be created. As an example, for connecting 2 LCD panels or multiple LED PWM outputs.

The code can be modified and redistributed as governed by the terms of the accompaning LICENSE file.

Code/Data Sizes (for 20080321 release)

CompilerCodeDataOptimization
IAR C62648Size high (+ 64 bytes stack)
AVR-GCC C72048-Os
IAR C++76249Size high (+ 64 bytes stack)
Codevision 2.02.6 C79648Maximum
AVR-GCC C++80650-Os
Imagecraft 7.16A C80648Full
IAR Obj111265Size high (+ 63 bytes stack)
AVR-GCC Obj157472-Os
Last modified: Thu 26 Jun 2008 15:03:14
Kevin Rosenberg
kevin@rosenberg.net
AVR is a registered
trademark of Atmel