EcoModder.com

EcoModder.com (https://ecomodder.com/forum/)
-   OpenGauge / MPGuino FE computer (https://ecomodder.com/forum/opengauge-mpguino-fe-computer.html)
-   -   2x16 LCD Display issues/discussion (https://ecomodder.com/forum/showthread.php/2x16-lcd-display-issues-discussion-3096.html)

dcb 06-16-2008 12:48 AM

2x16 LCD Display issues/discussion
 
FYI, the displays are a whole nuther discussion, so lets break it out here. I had an annoying failure on mine and another user is having to use an uncommon contrast setting (though there might be more going on there). Andrewj said his isn't working either (any news Andrew?) so lets us focus on that a bit here in a seperate thread. Please do try and be constructive, but we may decide that another LCD would be a better choice, though I will put a 2x16 constraint on it for 1.0. Or we may learn the cause of failure is external, but we need to be exacting in the process, not speculative.

FYI, I sent this of to nkc:
_____
Subject: LCD questions
To: orders@nkcelectronics.com

I've been recommending a single source for the LCDs for a fuel efficiency gauge to minimize compatability issues, and wanted to bounce a couple questions off you.

1. I have a LCD I purchased back on 4/6, that is just now missing column of dots (see picture)
http://opengauge.org/diympggauge/lcdmissingcolumn.JPG Do you have any sort of knowledge base about what makes these things fail? Or can offer any advice about how to keep them from failing?

2. Another person ordered the same LCD, we are using pwm @500hz for the contrast and I found that on most of the units that an analogWrite(15) made a useable display, but this person needs an analogWrite(100). Is there that much variance between otherwise identical LCDs or is it a sign that something else is going on?

Thanks,
Dave.

dcb 06-17-2008 08:27 PM

Heard back from NKC, nothing difinitive on the failure modes or the contrast differences, no suprise, but they offered to ship a replacement LCD :thumbup: , Since we seem to be moving towards CPU control of the lcd controller power, it might last a little longer once we get the timeout working <shrug>

cmags 06-20-2008 12:16 AM

Hey a thread about LCD issues... yay. I've gone and been a bad boy and ventured away from the "recommended LCD". My eyes are sensitive to glare, esp. at night, and a bright blue LCD would be unbearable to me, not to mention a distraction while driving. I picked up another HD44780-compatible LCD, the TEG16717, and am having some issues.

After running on the bench for just a couple minutes, the screen seemingly is losing synch (possible timing issue?) and just displays a single scrolling row of garbage: "?0°?█??█/o??█/█0" etc. When running v0.11, the █ blocks would show the custom characters from the 'duino memory so I assume that's where they're coming from in v0.62 from the big characters.

I can reproduce the issue at will by pulling LCD power and putting it back on (loses synch - would need a reset). I have verified via debug that the 'guino is still running, because I added a serial output of the time from the CPU Monitor screen. I can switch between the screens and enable/disable my serial output, even with my LCD corrupt.

It also seems that sometimes just touching my wires (longest being about 5" from the breadboard to the LCD) will put it into the corrupt state, but other times I can really shake them and nothing will happen. Seems random.

Could it possibly be timing? I don't see any delays in the LCD code such as other 4-bit libraries have, though they seem across the map. I haven't studied the code and HD44780 spec thoroughly enough yet to be sure.

Also, out of curiousity, is there a reason we're not using consecutive pins for the 4 data bits?

dcb 06-20-2008 12:36 AM

re: display funnyness, you need to power cycle the board and the LCD. They need to be initialized after being powered up to display correctly, and they (all) have a finicky initialization scheme AND don't like to be initialized twice for a given power cycle. I have updated the code so you can power the LCD pin 2 (and only pin 2) from arduino pin 15 (analog 1) and so the guino will turn it on and off for you and it should be much better behaved after resets and reprogramming. But it sounds like the lcd controller power might somehow be flaky if you can touch a wire and make it glitch.

re: pinout, tried to find a balance between short tidy hookups with the basic arduino layout backed up to the lcd, and a leaving multi purpose pins open for future enhancements (pwm, tx/rx, analog).

dcb 06-20-2008 12:43 AM

Also note there are delays at the bottom of
void LCD::LcdCommandWrite(byte value){
and
void LCD::LcdDataWrite(byte value){

try upping them to 10 maybe (display will be slower)

cmags 06-20-2008 11:48 AM

Yea, maybe my LCD has different power requirements, but hooking up the LCD power pin 2 (no backlight) to 'duino pin 15 won't power up the LCD. Doesn't matter where my ground is (pin 14 or GND).

Fortunately, the package I got had two LCDs included, so I can try the other one, and use a cleaner setup for wiring (maybe I'll use a couple short pieces of cat-5, with 3 or 4 pins used for data each, twisted with a GND.

I also tried inserting delays - in the lcdCommandWrite() I upped the delays from 1 to 2, but will be more aggressive. I also tried adding 50ms delays between all the initialization commands, also to no avail. I also tried bringing the main loop from a half second to a full second. Still no help, thought I didn't really expect it to.

The LCD was working beautifully with the sample codes on arduino.cc, but not with your code. Not sure what's going on. I'd really like to avoid having to rewrite the whole damn thing using one of their libraries. I did spend a couple hours last night with v0.62 printed out studying the code, so I have a decent feel for what's going on if it becomes necessary.

cmags 06-21-2008 12:59 PM

Hey, I just thought of something. I'm trying to get this thing up and running for a 2500mile trip I'm taking next week, and since I'm having LCD issues, are there any pieces of software that will display the output of the 'guino's serial print in a small window on the PC? I've already got a nice LCD screen in the car - a 7" TFT touchscreen for my carPC. If I can just get the 'guino to send the data back out to the PC rather than to an LCD, I won't have to worry about all these screen issues nor the fact that my LCD doesn't have a backlight.

dcb 06-21-2008 01:09 PM

Sort of, if you just uncomment the #debuguino line and connect to the guino via hyperterminal it will spit out the raw instant and current data. Shouldnt be too hard to change those Serial.print lines to print instant.mpg() and/or tank.mpg() or whatever. Run them through the format function first. The arduino IDE has a serial monitor also.

cmags 06-21-2008 07:40 PM

Yea, I know about the IDE serial monitor - used it a couple times for added debug, but that's not easy to hide in a corner on the screen (real estate is hard to come by on a 7" screen). I was thinking about hyperterminal, thanks for the confirmation... I'll have to look into it.

dcb 06-21-2008 08:01 PM

1 Attachment(s)
http://ecomodder.com/forum/attachmen...1&d=1214092859

cmags 06-21-2008 08:23 PM

Good point.. Though it took me a few minutes to figure out the point of that screen shot lol...

But I'd be trying to integrate it into this:

http://i18.photobucket.com/albums/b1...gs/iGwagon.jpg

dcb 06-21-2008 08:35 PM

Ok, Good luck, lets us get back to LCDs here.

AndrewJ, Whats the status on your LCD?

top_down 06-27-2008 01:23 AM

dcb, it appears I have experienced an early failure of my lcd tonight. Bummer... right when you posted the things I needed to change with the injector tap and vss number!

My guino power led is on and the other led is blinking as normal, but the lcd is dark. Tried the reset button on the guino and disconnecting and reconnecting power to no avail.

It seems to have happened when I was reconnecting my ground wire, and bounced power a few times as I tightened the screw.

Anything I should check for before writing it off? Do you think they'll send me a replacement like they did for you?:confused:

Thanks for all your help and work on this project!

dcb 06-27-2008 01:55 AM

See if you can reprogram the chip first. It doesn't like bouncy power. Let me know.

cmags 06-28-2008 11:29 PM

Quote:

Originally Posted by dcb;39365 (from workspace thread)
Glad the Mrs. is doing ok. It soulds like your display issues are an order of operations thing and not a hardware glitch per-se. Like you might need to bounce the power to the whole unit after you program it. Shouldn't affect in-car operation as long as you adjust your setup so the LCD is powered and connected to the duino before or at the same time the duino is powered up.

Not following you here. What I had been doing was powering the LCD from the 5V and GND pins on the 'duino (which is powered as soon as the power supply is plugged in). Not sure if its bouncy power on the LCD or if it is a timing thing, but a soft reset always temporarily resolves the issue.

I tried powering the LCD from pin 15, but it wouldn't power. My multimeter shows only ~2.5-3V on that pin (though I know it's being pulsed, I don't think its providing enough power). Haven't yet tried a separate 5V source, but I plan on trying to power both from a computer 4-pin molex - the 'duino from 12V and the LCD from 5V.

dcb 06-29-2008 10:27 AM

FYI, the latest version has a little more LCD initialization going on (v0.66), Let us know if that fixes it.

Yoshi 06-29-2008 02:29 PM

Quote:

Originally Posted by dcb (Post 39479)
FYI, the latest version has a little more LCD initialization going on (v0.66), Let us know if that fixes it.

Let me comment some...

The V0.66 init() starts...

void LCD::init(){
LcdCommandWrite(B00000010); // 4 bit operation

This sends (B0000) to DB7-4,
then sends (B0010) to DB7-4.
...

However, the HD44780 chip datasheet shows the 4 bit mode initialization is...

power on
wait for more than 15 msec
send (B0011) to DB7-4
wait for more than 4.1 msec
send (B0011) to DB7-4
wait for more than 100 usec
send (B0011) to DB7-4
send (B0010) to DB7-4 for 4 bit operation

Yoshi

dcb 06-29-2008 02:37 PM

Thanks Yoshi, I had an old lcd library I got that from. I "jiggled the handle" a little more in 0.66 and got it to come up reliably on reset. Will examine that sequence more closely for the next version.

Yoshi 06-29-2008 02:45 PM

Please refer to following 4BitLibrary.
Arduino playground - LCD4BitLibrary

Yoshi

cmags 06-29-2008 09:30 PM

I thought I had seen some minor differences in the 'guino's initialization code vs. some of the libraries on arduino.cc but I didn't get to really study the specs and codes yet, and figured there were multiple ways of doing it. Maybe the NKC LCD is more forgiving of tolerances than the one I have... I'll try v0.66 and let you know how it goes.

cmags 07-01-2008 12:48 PM

So once I uncommented the left/right button LCD re-init in v0.66, it will properly re-init my LCD, though I do see that the time for some reason resets when I do that - not to zero, but to somewhere between 12s and 1:37. :confused:

I also confirmed that the mpguino Game of Life has the same issue. I'm going to try to re-code the LCD class to more closely follow Yoshi's timing suggestions and see if I can kick this issue.

dcb 07-01-2008 12:52 PM

That would be awesome :), just a little history, I had trouble with both the 4 bit library and the datasheet yoshi referenced and wrestled with the LCD for a frustrating amount of time a few months ago.

Here is the point in time where I actually got something working:
http://ecomodder.com/forum/showthrea...html#post23329

And here is the datacheet referenced, don't know if it is the same one:

http://web.mit.edu/6.115/www/datasheets/44780.pdf

Also, are you using those ebay jobbies?

cmags 07-01-2008 07:07 PM

Yes, I am using the Ebay LCDs I picked up. They worked great with the 8-bit and 4-bit sample code on the arduino.cc site, so I expect that they're just a little less tolerant than the NKC LCD's timing wise. I'll let you know if I come up with anything that works.

Yoshi 07-09-2008 11:54 AM

Hi,
From the "OBD MPGuino gauge" thread...
Quote:

Originally Posted by dcb (Post 42323)
Is anyone willing to fix the 4 bit library?

Following is my proposal for the LCD init() routine.
I have not tested it yet. Please let me know it works or not.
Code:

void LCD::init(){
  delay(16);                    // wait for more than 15 msec
  value=pushNibble(B00110000);  // send (B0011) to DB7-4
  cmdWriteSet();
  tickleEnable();
  delay(5);                    // wait for more than 4.1 msec
  value=pushNibble(B00110000);  // send (B0011) to DB7-4
  cmdWriteSet();
  tickleEnable();
  delay(1);                    // wait for more than 100 usec
  value=pushNibble(B00110000);  // send (B0011) to DB7-4
  cmdWriteSet();
  tickleEnable();
  delay(1);                    // wait for more than 100 usec
  value=pushNibble(B00100000);  // send (B0010) to DB7-4 for 4bit
  cmdWriteSet();
  tickleEnable();
  delay(1);                    // wait for more than 100 usec
  // ready to use normal LcdCommandWrite() function now!
  LcdCommandWrite(B00101000);  // 4-bit interface, 2 display lines, 5x8 font
  LcdCommandWrite(B00001100);  // display control:
  LcdCommandWrite(B00000110);  // entry mode set: increment automatically, no display shift

//creating the custom fonts:
  LcdCommandWrite(B01001000);  // set cgram
  static byte chars[] PROGMEM ={
    B11111,B00000,B11111,B11111,B00000,
    B11111,B00000,B11111,B11111,B00000,
    B11111,B00000,B11111,B11111,B00000,
    B00000,B00000,B00000,B11111,B00000,
    B00000,B00000,B00000,B11111,B00000,
    B00000,B11111,B11111,B11111,B01110,
    B00000,B11111,B11111,B11111,B01110,
    B00000,B11111,B11111,B11111,B01110};

    for(byte x=0;x<5;x++)
      for(byte y=0;y<8;y++)
          LcdDataWrite(pgm_read_byte(&chars[y*5+x])); //write the character data to the character generator ram

  LcdCommandWrite(B00000001);  // clear display, set cursor position to zero
  LcdCommandWrite(B10000000);  // set dram to zero

}

Regards,
Yoshi

Magister 07-09-2008 03:45 PM

It should work, also you do not need the "value=" in front of each pushNibble.

I noted that the "xarias" guy is using the same 15, 4.1, 0.1 delay in his code.

cmags 07-09-2008 04:21 PM

I'll try that out tonight, though it seems that my 'guino is running the LCD more solidly now that I hardwired everythign instead of using the breadboard. Must have been too much capacitance in the BB causing glitches. Being right on the edge of the timing threshold wouldn't help that either, so I'll still try this for good measure.

jksoft 08-19-2008 06:45 PM

Partial LCD issue
 
I have been working on my Mpguino for some time but only a few minutes here and there. It seems I am having a issue with my LCD where the left half has nice clear text, but the right have is just solid blocks. At one point it was working completely. I have double and triple checked the wiring and can't find any problems. Any idea how the data lines map to the screen and what might cause half the screen to have issues?

J

cmags 08-19-2008 07:04 PM

What LCD do you have? How long are your traces from the 'duino to the LCD? If you try another program (like DCB's game of life), does the same issue occur?

jksoft 08-19-2008 07:20 PM

Quote:

Originally Posted by cmags (Post 54581)
What LCD do you have? How long are your traces from the 'duino to the LCD? If you try another program (like DCB's game of life), does the same issue occur?

It is the blue one from NKC. The wires are probably about 6 inches...it is still in breadboard mode...I was planning to shorten them when I built it permanently. I haven't run another program but will do that next.

j

cmags 08-19-2008 07:25 PM

I dont know if it applies to you or not, but I had issues with my breadboarded version ("alpha") that I couldn't lick until I transferred to solderboard ("beta"). Even then I had some trouble (but far less), and am working on a new LCD (and iDuino instead of Freeduino) for my now "production" version. It reminded me of my engineering school days where we would run into issues with old breadboards introducing too much capacitance into a high-frequency circuit.

I know its not much help, can anyone else chime in?


All times are GMT -4. The time now is 04:46 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Content Relevant URLs by vBSEO 3.5.2
All content copyright EcoModder.com