Go Down

Topic: LiquidCrystal syntax help (Read 787 times) previous topic - next topic

mam5019

Hi all,

I have a quick question dealing with the liquid crystal library. I am trying to use it to control an lcd set up as a 4-bit display. I currently have the R/W line tied to ground so that it is write only. Is there a way to use this library with that setup?

My problem comes from the command to set what pins I am using, I am not sure what to put in for the r/w pin.

The syntax-
LiquidCrystal(rs, rw, enable, d4, d5, d6, d7)
My code-
LiquidCrystal lcd(12, gnd, 2, 7, 8, 9, 10)

Thanks!!

- Mark

mem

#1
Feb 24, 2009, 07:05 pm Last Edit: Feb 24, 2009, 07:05 pm by mem Reason: 1
The current version of the Library does not do much with the RW pin. It enables it as OUTPUT when the class is created and it sets it low whenever the LCD is written to.

You could set RW to any unused pin number but if you have none free then you may want to comment out few places in the LiquidCrystal.cpp  that do something with the pin:

[font=Courier New]LiquidCrystal::LiquidCrystal
{
 _data_pins[0] = d0;
 _data_pins[1] = d1;
 _data_pins[2] = d2;
 _data_pins[3] = d3;
 
 pinMode(_rs_pin, OUTPUT);
[glow]//  pinMode(_rw_pin, OUTPUT);[/glow] [/font]

And

[font=Courier New]void LiquidCrystal::send(uint8_t value, uint8_t mode) {
 digitalWrite(_rs_pin, mode);
[glow]//  digitalWrite(_rw_pin, LOW);[/glow] [/font]

Don't forget to delete the LiquidCrystal.o file. You may also want to put a comment in the file to remind yourself that it changed.

mam5019

Thanks alot for the help! I am going to go do the changes now and hopefully it works. Thanks again!
:)
- Mark

Go Up