PC0802ARS 8x2 LCD pin assignment

Hello, I am about to hook up an 8x2 LCD screen to my arduino uno board. I have read that I should use the LiquidCrystal library to make it easier. I can see in the data sheet that I need to wire up 14 different wires. I know one of them has to go to "5V" but I am using that for a flowsensor. Can i just use a digitalpin and make it "HIGH" instead?

I am also in doubt which wires to go where. I am afraid to short circuit it. I would really appreciate any help in where the wires need to go, and what to write in the LiquidCrystal lcd( "pin numbers")

Best regards, Jens

I can see in the data sheet that I need to wire up 14 different wires.

You will be connecting LCD pin 5 to GND and you don't need to use LCD pins 7, 8, 9, and 10. This leaves you with just 9 wires to connect.

I know one of them has to go to "5V" but I am using that for a flowsensor. Can i just use a digitalpin and make it "HIGH" instead?

You can connect both the LCD pin2 and the flowsensor to 5V at the same time.

I am also in doubt which wires to go where. I am afraid to short circuit it. I would really appreciate any help in where the wires need to go, and what to write in the LiquidCrystal lcd( "pin numbers")

Use the tutorial at http://www.ladyada.net/learn/lcd/charlcd.html

// initialize the library with the numbers of the interface pins
// LiquidCrystal lcd(RS, E, D4, D5, D6, D7);
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

Notice that I have added a comment to the example sketch. In LiquidCrystal lcd() you match up the Arduino pin numbers that you are using to the LCD pin designations shown in the added comment.

Don

I see :) But can the 5V output supply power enough for both the LCD screen, and my flowsensor. The flowsensor requires 5-24V.

And thanks for the tutorial link, that will come in handy :)

Best regards, Jens

But can the 5V output supply power enough for both the LCD screen, and my flowsensor. The flowsensor requires 5-24V.

What is important is the amount of current that it requires. If it is a 'sensor' then the current will most likely be minimal. Can you provide a link to the datasheet?

Don

http://www.seeedstudio.com/depot/g12-water-flow-sensor-p-635.html is the flow sensor, it requires maximum 15miliamps http://www.farnell.com/datasheets/355518.pdf is the datasheet for the LCD screen.

Best regards, Jens

these Hitachi LCDs don't need much current.

It is indeed better to power them through digital I/O, after some reasonable delay. Because digital I/O will raise from 0 to 1 almost immediately.

There is also 4bit mode you only need 4 wires it requires a bit weird startup sequence (beyond logic), but it's worth the efforts in order to save wires.

There is also 4bit mode you only need 4 wires

The availability of the 4-bit mode was explained in reply #1. It requires at least six I/O lines.

it requires a bit weird startup sequence (beyond logic)

There's only one extra step in the startup sequence and this is irrelevant if you are using an available library.

Don

@floresta

I agree. It is not always possible to see all details when I read posts. It is not relevant if you have the library but I'd second it is just one additional step. Because I tried that years ago, and had no luck. Then I followed exactly the weird sequence I saw on a webpage, and then it worked.

There is also the possibility to use most of these LCDs at 3 volts even 2.5 volts, having a small charge pump.

Maybe this is not relevant information for you, I was very happy recently, when I had success with 4bit mode, and low voltage.

I also had the case where sometimes garbage would show, when I powered them directly. I don't know if this was the reason but now I use digital I/O, and a delay, before powering them up.

 lcd_cmd(0x03,4);
 lcd_cmd(0x03,1);
 lcd_cmd(0x03,1);
 lcd_cmd(0x02,1);

 lcd_cmd(0x02,1);
 lcd_cmd(0x08,1);

 lcd_cmd(0x00,1);
 lcd_cmd(0x0c,1);

 lcd_cmd(0x00,1);
 lcd_cmd(0x01,4);

 lcd_cmd(0x00,1);
 lcd_cmd(0x06,1);

this is my startup code (8x2 LCD), following directly the instructions from a webpage, it took me 2 hours or so, even if I used these LCD before in 8bit mode.

One other consideration is currently I am preparing to use a small TFT, based on ST7735, and there is so much complicated information in the datasheet, do you really mind my few lines reply here?

You have the library (so it is kinda irrelevant) but the truth is I think in order to switch to 4 bit mode, there is more than just one extra command to send.

this is my startup code (8x2 LCD), following directly the instructions from a webpage,

If you convert the magic numbers from hex to binary you will see that you have nothing more than an incorrect adaptation of the data sheet flowchart for the 4-bit initialization (Fig 24). What is incorrect is this step

    lcd_cmd(0x00,1);
   lcd_cmd(0x0c,1);

where they are turning the display ON when the flowchart unequivocally says to turn it OFF.

That step should be moved to the very end and in it's place should be

    lcd_cmd(0x00,1);
   lcd_cmd(0x08,1);

If it makes you feel any better the LiquidCrystal library has the same error. It works, but that doesn't mean that it is correct.

For a complete explanation follow the [u]LCD Initialization[/u] link at http://web.alfredstate.edu/weimandn.

Don

Well yes I generated the hex numbers, actually, using a flowchart I found on a webpage.

Interesting you write this is still incorrect, so maybe I should spent more efforts on it.

Also thanks for the links.

I have tested the modification you suggest, and it also works, I don't encounter any visual difference.

Im my code I take care of the timing, via interrupt controlled delay, and I have a delay in my startup, after that I switch on the LCD power via digital I/O.