views:

233

answers:

2

I have an HD44780 LCD screen, and I've been using the LiquidCrystal Library provided with the Arduino development package. However, it's not reliable. I noticed some problems with it, and instead of being interrupt driven, it just sleeps as long as the developer thinks the chip should take to execute the operation.

From the spec sheets, the BUSY flag will be set while it is executing, meaning it is possible to be interrupt driven.

Does anyone know of a library that actually does this, and does it require all 8 bits to be connected or can I keep it at 4 pins?

+2  A: 

I don't think you need an interrupt for this. Looking at LiquidCrystal.cpp in the Arduino distribution, you just need to change the LiquidCrystal::write4bits, LiquidCrystal::write8bits, and LiquidCrystal::pulseEnable code. The first two methods should start by monitoring the busy line (BD7) before writing data, and the last one would be modified to remove the 100us pause.

I think the reason this wasn't done in the default code is that many users of these LCDs just tie R/W to ground so the display is always in write mode, making it impossible to read the BUSY signal. However, this is passed into the library by setting _rw_pin to -1, so the pulse and write code can conditionally use the r/w pin as a way of detecting busy as a speed optimization.

Ben Combee
I will try this this weekend.
Malfist
A: 

It is possible to use 8 bit on three pins; you just need a shift register. I'm using a HEF4094BP from mouser.com (shipping is going to cost more than the actual chip)

the wiring diagram and code modifications for the shift register are here: http://www.arduino.cc/playground/Code/LCD3wires

Ian C.