Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

The Arduino LiquidCrystal library has 4 constructors with different arguments:

LiquidCrystal(rs, enable, d4, d5, d6, d7) 
LiquidCrystal(rs, rw, enable, d4, d5, d6, d7) 
LiquidCrystal(rs, enable, d0, d1, d2, d3, d4, d5, d6, d7) 
LiquidCrystal(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)

The following comments are stated for the constructor arguments:

[...] d0, d1, d2, and d3 are optional; if omitted, the LCD will be controlled using only the four data lines (d4, d5, d6, d7).

What is the point of d0-d3 if they are not needed? Will they decrease the response time?

share|improve this question

2 Answers 2

up vote 8 down vote accepted

That type of LCD has two main modes of operation: 4-bit mode which uses 4 data pins (d4-d7), and 8-bit mode which uses all 8 data pins (d0-d7).

4-bit mode has the advantage of requiring fewer output pins on your Arduino. However, it means your sketch needs to send each command/character as two separate batches of 4-bits (one after the other). This is handled for you automatically by the LiquidCrystal library, so you won't need any extra complexity in your code. However, it does mean that your sketch requires roughly double the number of processor cycles to send anything to the LCD.

In contrast, 8-bit mode sends each command/character as a single batch of 8-bits. That simply means it technically runs a little faster.

With that said, a person looking at the display probably won't see a significant speed difference most of the time, as it still goes very quickly. The main impact will be on the microcontroller (the Arduino in this case). If it can use the faster 8-bit mode then it can devote a little more processing time to other things. That can be particularly helpful for timing-critical applications.

share|improve this answer

The answer is on the same page as the quote you mentioned (I have highlighted the important statement):

Creates a variable of type LiquidCrystal. The display can be controlled using 4 or 8 data lines. If the former, omit the pin numbers for d0 to d3 and leave those lines unconnected. The RW pin can be tied to ground instead of connected to a pin on the Arduino; if so, omit it from this function's parameters.

It turns out that the Hitachi HD44780 LCD display can work in 4-bit or 8-bit modes.

share|improve this answer
1  
Yes, it says it can be controlled using both 4 and 8 data lines. But what is the point of using 8 if you only need 4? I mean, isn't there any advantage of using 8 over 4? Why waste 4 data lines if it's of no use? –  Friend of Kim Mar 30 at 11:28
1  
Using 8 bits mode is a bit faster on Arduino side and simpler (less code). But in general, it is not really worth it, in comparison to sparing 4 output pins. –  jfpoilpret Mar 30 at 13:24
    
@jfpoilpret It's worth it if you have four extra output pins... –  Annonomus Penguin Mar 30 at 19:57
    
@annon can you be more concrete about HOW it is worth to use 8 pins mode? Concrete experiment values? –  jfpoilpret Mar 30 at 20:02
1  
@jfpoilpret As stated in Peter's answer, it gives a little more processing time to the chip. If you have four extra pins, go ahead and add it. If it would require it to be much bigger/more expensive, it's not really worth it. –  Annonomus Penguin Mar 30 at 20:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.