SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By OrlandoArias
Due to my lack of willingness to use C++ as a development platform for embedded systems and the poor state of the LiquidCrystal library that was provided a while back with the Arduino IDE, I decided to write my own library for this purpose [1]. The code now sits on my subversion repository over at Google code [2]. The library is capable of handling the LCD in 8bit, 4bit mode and by means of a 74xx164 or compatible shift register. When using 8bit and 4bit mode, the library requires to wire the R/~W pin to an I/O pin in the microcontroller since it uses the busy flag to determine whether or not a command has finished executing. The timing on the library should cover most if not all HD44780 and alike controllers.

The library itself is written in C and it allows you to have as many LCDs as you can fit on your platform of choice. It is built upon the wiring environment in order to retain compatibility among various AVR chips.

Supported operations:
- 8bit and 4bit LCD operations
- Operation thru a 74xx164 or compatible shift register
- Read from LCD [3][4]
- Write to DDRAM/CGRAM [5]
- Support for multiple LCDs, each with its own mode, in a program.

I am now in the process of documenting and commenting the library as well as optimizing the code. I have only tested the shift register implementation as it is the easiest to wire. I am not, by any means, trying to reinvent the wheel here. This is a tried and done subject.

What I'd like to ask of people is to comment on the code on how to make it far more optimal, small binary footprint is the primary goal, secondary goal being as little as RAM usage as possible. I follow the principle that if there's a solution that can be implemented in the hardware (by means of a circuit), it should take priority over a software solution. I am thinking of extending the shift register implementation to use a monostable multivibrator (one shot) to eliminate the need of a software clock for the LCD. I have yet to decide how to do this, however. If interest arises, I will post on it.

The library is under the GPLv3, feel free to do with it as you please, as long as you respect that license.

Thanks, Orlando.

[1] Thread is now buried somewhere in the Arduino forums, can't find it
[2] ... 0/generic/
[3] Status flag, Address Counter and DDRAM
[4] read operation available in 4bit and 8 bit implementations only
[5] CGRAM write support provided only for 5x8 character size operation, sample implementation for 5x10 character size included with documentation
By mcuaust
Interesting. I'll have a look when I get a chance.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]