Pages: [1]   Go Down
Author Topic: LCD displaying wrong character  (Read 1770 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The code in my sketch has been working correctly but as the sketch is getting bigger I occasionally get an invalid character in the same place on the display.  This has happened twice on two different "screens" and the invalid character was not in the same place on the display in the two "screens".  My sketch had gotten to within 1K of the max and the first time I removed some non-essential code and it cleared it up.  The next time I reworded the text slightly and it cleared that up. 

In trying different things, I changed just the invalid character but left it in the same position.  It still displayed an invalid character.  In all cases where this has occurred the invalid character was the next one on the ASCII chart following what would have been correct.

I'm using a NewHaven 40x4 display and LiquidCrystal440.h library.

Any ideas? 
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4259
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
In all cases where this has occurred the invalid character was the next one on the ASCII chart following what would have been correct.
That's a good start.  Another piece of information, which may or may not be of significance, is what the lowest bit of the desired character should be.  Is it always a '1' being changed to a '0', a '0' being changed to a '1', or does any character always get changed to the next one?

Don
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, it is not the same character always being changed.  But when one is changed it is always to the next character in the ASCII table.

For example:

Should be: "Set pH in CaRx"
Displayed: "Set qH in CaRx"

If I changed it to: "Set PH in CaRx"
It displayed:         "Set QH in CaRx"

I reworded it to: "Set CaRx pH" and it worked fine.

As I said it only started misbehaving when the sketch got within 1K of max.  That is the only problem I've noticed as everything else seems to be working fine.  This is a controller for a Saltwater Reef Aquarium.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4259
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe you didn't understand what I was asking.

ASCII p ==> 01110000
ASCII q ==> 0111000
1

ASCII P ==> 01010000
ASCII Q ==> 0101000
1

These examples both tell us that a '0' is being changed to a '1'

How about seeing if a '1' gets changed to a '0' under the same conditions?
In other words if you try to display "Set qH in CaRx" does it display "Set rH in CaRx"?


Quote
As I said it only started misbehaving when the sketch got within 1K of max. 
This is probably significant.

Quote
That is the only problem I've noticed as everything else seems to be working fine. 
It's easy to spot an error on the display.  How easy would it be to spot an error that occurs elsewhere in your controller program?

Don

Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4259
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'm using a NewHaven 40x4 display ...
Specifically, which NewHaven display are you using?  At least some of their displays, while mostly HD44780 compatible, have some slight differences in one or two commands.  The commands I know about that are different are concerned with clearing the display so I don't think they will affect your problem.

Quote
... and LiquidCrystal440.h library.
I guess you know that this library is for the older versions of the Arduino IDE.

Don
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe you didn't understand what I was asking.

ASCII p ==> 01110000
ASCII q ==> 0111000
1

ASCII P ==> 01010000
ASCII Q ==> 0101000
1

These examples both tell us that a '0' is being changed to a '1'

How about seeing if a '1' gets changed to a '0' under the same conditions?
In other words if you try to display "Set qH in CaRx" does it display "Set rH in CaRx"?


No, it didn't try to change the "q" to "r".  As a matter of fact, now it displays the "p" correctly but now it changes a "n" to "o".  This is after I added some more code to the sketch.  Seems like a memory issue to me.

Quote
As I said it only started misbehaving when the sketch got within 1K of max. 
This is probably significant.

Quote
That is the only problem I've noticed as everything else seems to be working fine. 
It's easy to spot an error on the display.  How easy would it be to spot an error that occurs elsewhere in your controller program?

Don


Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4259
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
... but now it changes a "n" to "o".

It's still changing a '0' to a '1' for what it's worth.

ASCII n ==> 01101110
ASCII o ==> 0110111
1

Don
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4259
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I reworded it to: "Set CaRx pH" and it worked fine.
I missed this part. 

See what happens if you change "Set pH in CaRx" to "Set pH CaRx in" .  This will keep the string length the same.


Don

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems like when I change something or add to something in the sketch the error occurs in a totally different place.  I wonder if the problem is in the Arduino or if the compiler is creating the error and sending the wrong data over.
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I wonder if the problem is in the Arduin

I would venture a guess: it is likely there is some overbound addressing of an array somewhere.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I wonder if the problem is in the Arduin

I would venture a guess: it is likely there is some overbound addressing of an array somewhere.


Meaning I may need to increase the size of the char arrays?
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You want to isolate problems, not to go with some trial and error in your enormous project code.

In a totally empty sketch, set up necessary library to use the LCD to display the phrase that would be displayed wrong in your project code, will it be displayed correctly? Your code space is 1K from being filled so unless you have practiced extreme measure to save SRAM space, you have run out of SRAM long ago.

When wrong characters are displayed, is your project still respond or run as expected?
Logged


Pages: [1]   Go Up
Jump to: