floresta:
Actually it only requires 2 (from experience) control lines since the vast majority of time the R/W line is tied to GND and delays are used in place of reading the busy flag.
The ability to save a bit of program execution time by reading the busy flag is offset by the fact that your entire program may crash if the LCD (which may be a relatively unimportant system component) fails. There's also the fact that extra program code is required which is not provided by many libraries.
Don
With Arduino, particularly on the AVR processors, using BUSY can actually be slower than not using it for regular instructions (the ones other than clear & home)
The reason is that the code implementation of the digital i/o functions (pinMode(), digitalRead(), digitalWrite() ) in the standard AVR core code are so slow.
Assuming in 4 bit mode and you have a minimal custom BUSY read function, you would have to:
- turn all the data pins into inputs (4 pinMode)
- set RS to LOW (1 digitalWrite)
- set RW to HIGH (1 digitalWrite)
- set E to HIGH (1 digitalWrite)
Then you can start to poll the BUSY line.
Which is 1 digitalRead per "look" (which can be done while E remains high)
Then when BUSY is gone, then you have drop E (1 digitalWrite)
That is a minimum of 9 digital i/o functions to look at BUSY.
the Arduino digital i/o functions often take a bit over 6us so you are looking at least 36+ us just to do a single poll and 6us per "look" waiting for the BUSY to change.
And that is before looking at any other code overhead including extra "smarts" to not get hung polling.
From my testing , by the time you have a proper BUSY polling function, it ends up being a bit slower than busy loop on the AVR processors using the the standard Arduino digital i/o functions, particularly if the library code is smart enough allow the LCD to execute commands while the AVR is freed up to do other things vs doing to dumb/blind wait.
If the code choses to bypass the slow Arduino provided digital i/o functions and instead uses raw port i/o, things change quite a bit as AVR raw port i/o is 50X faster.
But doing AVR raw port i/o is not portable and creates maintenance issues.
In my hd44780 library, while it does support using r/w for reading LCD display ram, I opted not to use BUSY, and instead used a smart wait for execution delays which allows the Arduino processor to run in parallel with LCD instruction processing.
While this isn't quite as fast as using BUSY with AVR raw port i/o it is portable across all the processors and is much faster than code that uses the typical blind wait execution delays.
-- bill