That problem with strange characters again...

Hello all

I'm relatively new to all the Arduino programming, but managed to get pretty much everything I needed to do, done. However, this LCD thing is doing my head in.

I've connected an LCD (SparkFun ADM1602k, 16x2) and it works fine, backlight, contrast etc. However, when I send some .print() to it, it fails and gives me incomprehensible garbage. I knew there was some information we could get from these scrambles so I added a picture to the thread for your perusal.

I've taken a look at the wires, I even re-soldered to make sure the structure of each pin was sufficient. Not so sure about the jump wires (this isn't going through a bread board). All wired up as per the Arduino tutorial on their website (and no, I didn't accidentally read the thing upside down).

Any help or advice from you experts is welcomed - I'm a total noob!

All the very best.

IMG_2817.JPG

IMG_2818.JPG

Hi and welcome.

1e9560d4982d080f4032024e1138648d03ef8346.jpg
e09fde4d63e6fb85a109038f66acd89d5389ad6f.jpg

Please take a photo of the wiring (tidy up first so that the wires can be followed and people can see where each one goes).
Show the picture(s) here.

Thanks. As it's wired straight into my board it's hard to 'tidy up' but I've done my best. You can make out what's wired where. I should also point out that this is a RasPiO Duino board but it's Arduino-based and has all the relevant libraries as it only runs on Arduino.




  • Pin 3 goes off to a potentiometer (10K1 I think) which is 5V and GND on outside legs.

I should also point out this is wired up based on the fundamental requirements for most LCDs which should be enough, but isn't!

Hope this helps. I appreciate your time.

stormdart:



Thanks Paul

I can confirm the scrambled text isn't random, so its not QUITE as bad?
See Data Sheets and what not...

Thanks again everyone, you are great.

I can confirm the scrambled text isn't random, so its not QUITE as bad?

That is correct. Actually your data is skewed by a nibble, a problem that comes up occasionally with the LiquidCrystal library when driving a possibly out-of-spec (slow) display in the four-bit mode.

Take a look at the binary values for the last three letters of your message and compare them to the binary values for the last two characters that are displayed.

n               d               s
0 1 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 1 1

        rho             G
        1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1

You can try the LiquidCrystal440 library which was written to drive 40x4 displays but which also was written to work properly with out-of-spec displays. To get a copy start here:--> Google Code Archive - Long-term storage for Google Code Project Hosting. and follow the Downloads link to get to the latest version.

Don

Hi Don

Just to update, managed to install the LiquidCrystal440 library into Arduino. Called this instead of the standard LiquidCrystal and got a couple of compilation errors. Is there something further I should do? I also notice that the LiquidCrystal440.h doesn't highlight in brown like the LiquidCrystal.h did..?

I feel like I'm getting there though with your help.

Almost there!

Nat.

Okay - so tweaked the LiquidCrystal440 library and managed to get it so my sketch would compile - I changed the following if anyone is interested:

In the .h and .cpp files respectively, I changed:

virtual void write(uint8_t); 

inline void LiquidCrystal::write(uint8_t value) {
  send(value, HIGH);
}

To:

virtual size_t write(uint8_t);

inline size_t LiquidCrystal::write(uint8_t value) {
  send(value, HIGH);
  return 1;
}

Then my sketch compiled! However - it is now having exactly the same issue, with exactly the same problem and exact same scrambled words (same non-random scrambles as when I was using the LiquidCrystal.h) - slowly losing the will to continue here...

Any further thoughts? These SparkFun LCDs are quite new - not old, so not sure why I'm even having these problems?

Many thanks again,
Nat

Any further thoughts? These SparkFun LCDs are quite new - not old, so not sure why I'm even having these problems?

Does this mean that you have more than one display and they are all exhibiting the problem? If you only have one of them you may just have gotten a dud.

Which version of the Arduino IDE are you using. There have been some recent changes (in version 1.6.6) that have messed up some I2C libraries so maybe there are other problems as well.

Don

Hi Don

Thank God you're here - no I'm using one LCD panel and its brand new. Perhaps I have got a dud, can't see that being likely though..?

All I know is it uses the Gertboard version of the Arduino Integrated Development Environment (IDE) modified by Gordon Henderson. Does that make any sense to you?

Its really flummoxed me and its frustrating.

Thanks,
Nat

All I know is it uses the Gertboard version of the Arduino Integrated Development Environment (IDE) modified by Gordon Henderson. Does that make any sense to you?

No. You probably should use an unadulterated version of the IDE.

If that doesn't work then you can try some LCD code that does not involve a library. That way, if your display still does not function properly you can easily increase the appropriate delays and see if that fixes the problem.

Follow the LCD Programming Examples link at http://web.alfredstate.edu/weimandn and use the first Arduino example.

Make sure you download the code from the 'source code' link otherwise you may pick up some of the html code used for generating the web page.

Don

Don you are a genius - plus this way is much simpler, only downside is your sketch is clogged up with lots of code - but it works!

Now, see image below:

How do I use this for something meaningful - I notice it isn't the standard lcd.print(); functions? How can I use this and integrate it with the script I'm working on? I'm not even sure where this is being printed?

I just copied and pasted the source code into a new file and uploaded it to the board.

Thanks,
Nat

Well now you know that your connections are correct and that your device functions as well. Your controller could still be out-of-spec or more likely close to being so. See the second paragraph of the program notes explaining the time delays.

My code is not a library so it isn't easily integrated with the script you are working on. The code was generated to demonstrate how to implement the information in the LCD controller data sheet. If you look at all three implementations (assembly, C, and Arduinoese) you will see that the program structure is the same and the comments are identical regardless of the language.

The strings that are being displayed are located just after the "// Program ID" comment. I only used two of the three strings located there.

Information is being printed by the "lcd_write_string_4d( . . . );" statements in setup(). Note that the cursor position is changed for the second string.

Don

Thanks again, Don

I managed to get my entire script to work. Just embedded it amongst yours and shifted some bits around.

People shouldn't bother with libraries. Especially when your script is a lot shorter than most of them anyway!

Thanks for the help guys. Top job.

Nat.