AVR SERIAL_LCD C/C++ PROJECT Kevin M. Rosenberg AVRFreaks.net member kmr ===================================================================== The home for this project is http://www.avrcode/serial_lcd/ 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 20080320 release) ====================================== Compiler Code Data Notes --------- ---- ---- ----- IAR 5.10A C 626 48 Size optimization high (+ 64 bytes stack) AVR-GCC 4.2.2 C 720 48 -Os IAR 5.10A C++ 762 49 Size optimization high (+ 64 bytes stack) Codevision 2.02.6 796 48 Maximum size optimization AVR-GCC 4.2.2 C++ 806 50 -Os ImageCraft 7.16 Pro C 806 48 Full optimizations (-O24) AVR-GCC 4.2.2 C++ Obj 1574 72 -Os IAR 5.10A C++ Obj 1112 65 Size optimization high (+ 63 bytes stack) I would appreciate submissions of suggestions, improvements, or bug fixes.