Vermes
Advanced Member level 4
It is an issue of the scope of microcontrollers, especially from the side of programming. Unfortunately, libraries supporting peripherals available on the Internet are poorly documented and often little universal. TavrLib library allows to support the port expander PCF8574 and alphanumerical display HD44780.
The program was written in C, applying to the standards of object-oriented language. “Private” functions (for internal library use) have names starting with underscore. The user (programmer using the library) know which functions should not be used.
There are many procedures to support the display, unfortunately they often contain errors (in particular the inappropriate word-wrap), most are written for a specific (or nearly specific) size of the display. The code of this project is unique – procedures for all types of displays are in one file (configurable by macro- definitions), everything is properly documented (using Doxygen). Besides, usually the source code from the Internet is not clearly established rules of use – on tAvrLib the GNU licence LGPL v3 was used. It is a very liberal and not causing problems when used in commercial projects.
Opportunities of the library in the context of HD44780 display service:
- work in the 4-bit without reading the busy flag
- possibility of any assignment of terminals
- equipped to handle all sizes of screen – just type the number of rows and columns in the configuration. It also supports displays with two lines of E (2x16, 4x16, 4x20 and 4x40 were checked)
- possibility to bind to the standard output (stdout), so you can use standard functions such as printf(). After initializing the display (by two commands), display support can be performed in a fully transparent
- functions that operate on character strings are in “safe” version – the length of the string should be given as one of the arguments, instead of placing the character “\0” in it. This increases security and enables the seamless use of the characters “\0” - “\7” (under which there are encoded some characters)
- possibility to choose one of four encodings: ASCII, UTF8, CP1250 and ISO8859-2
- NULL character handling in strings of text
- ability to communicate in 8bit mode and reading the busy flag (also for 4x40)
- standard output scrolls the screen after reaching the last row (as in the console on the PC)
- several optimization and better compliance with documentation HD44780
1.0.0
1.0.1
Connection diagram for a sample program
Link to original thread (useful attachment) – tAvrLib: nowe procedury obsługi wyświetlacza HD44780