LCD Display troubleshooting.

Hi, I have another problem. My LCD Display doesn`t always show the right thing when I turn on the arduino. I have 2 LCD adn 2 Arduino, so I tried to crossed it wheter the programming or the LCD or the arduino is wrong. Seems to me like the programm.

so for example first after set cursor to (0,1) // row , coloum what shown the cursor is on (0,5) and the character is shifted. The other time turn it on..., it will shows some ugly messy characters.

After trying times by times..., the desire display comes up. Some one can tell me why is this could happening?

It sounds like it is not initialising correctly. This could be due to insufficient time between initialising commands. It could also be due to initialising it too soon after power up, put a small delay in the setup() routine before you initialise it. It could also be the voltage is low, check what voltage you have in circuit under load. Finally it could be the rise time on the power supply being too long have you measured this?

It sounds like it is not initialising correctly. This could be due to insufficient time between initialising commands. It could also be due to initialising it too soon after power up, put a small delay in the setup() routine before you initialise it.

It could also be due to a reliance on initialization by the 'Internal Reset Circuit' instead of using the recommended 'Initialization by Instruction'.

so for example first after set cursor to (0,1) // row , coloum

This is backwards. The syntax is: lcd.setCursor(col, row)

what shown the cursor is on (0,5) and the character is shifted.

It would help to know what type of LCD you are using. This symptom shows up on lines 3 and 4 of a 16x4 LCD when used with the current version (Arduino v0018) of the LiquidCrystal library.

There are a lot of poor LCD programs floating around and it looks like you might be using one of them. If you post your entire sketch we might be able to offer some more reliable suggestions, right now we are just guessing.

Don

Yes, I`m using LCD dip204-4 with KS0073 controller. Actually there are 2 problems... 1. just what i said be4. Random display when turning it on. Sometimes right sometimes not.

  1. It`s kind of autoreseting after about 5 hours or so. So...after I set a variable using interrupt ( For example , X = X + 2) if X initialize as 0 then by pressing button interrupt it will become 2. But after 5 hours..it will become 0 again.

Hi Mike, Rise time wont be too long...coz right now im using USB. I think i already give enough delay maybe i`ll put some more. Thanks a lot.

Yes, I`m using LCD dip204-4 with KS0073 controller.

So I guessing that it is a 20x4 display. A link to the datasheet would have been helpful.

just what i said be4.

As a native English speaker I can translate this. You saved three keystrokes and probably eliminated the possibility help from many other readers of this forum.

Random display when turning it on.

What looks "random" to you might not be so random to someone else. Can you give examples of what you expected and what you got?

Would "it" be the LCD alone, the Arduino alone, or the LCD/Arduino combination. There's a big difference when it comes to troubleshooting possible initialization problems.

after I set a variable using interrupt

You really should get the LCD working properly before you start messing with interrupts. Have you been able to get the 'hello, world!' example at http://arduino.cc/en/Tutorial/LiquidCrystal to work?

Rise time won`t be too long....

Maybe it's too short....

coz

You saved some more keystrokes here. Your shift key seems to be intermittent as well.

Once again: If you post your entire sketch we might be able to offer some more reliable suggestions, right now we are just guessing.

Don

What pins have you wired the lcd to? have you used these accidentally for something else? some details of the connections will also help. I have experienced this when the LCD data lines are not in the proper order or if there is some kind of loose contacts.

@Floresta, sorry I used to type in the short manner.

  1. Heres the link for the LCD.
    www.lcd-module.de/eng/pdf/doma/dip204-4e.pdf

  2. okay…random but with patern.
    Such: *^()!@#
    *^()
    !@#
    *^()_!@#6V6…somewhat like this.

and I expect
20.000 HELLO WORLD
40.000

  1. My LCD have already works properrly. Hello world making new characters and interrupts, I have tried them all. But…sometimes when I turn on my arduino (from off condition) or after uploading, the display isn`t what I want.

Okay I`ll post u the sketch.
#include <lib4LCD.h>
#include<stdlib.h>

int Interrupt1 = 0; //The Intterupt 0 is on DIGITAL PIN 2
int Interrupt2 = 1; //The Interrupt 1 is on DIGITAL PIN 3
int Interrupt3 = 5; //The Interrupt 2 is on DIGITAL PIN 18
int Interrupt4 = 4; //The Interrupt 3 is on DIGITAL PIN 19
int mode = 0; // Flag for mod
int mode1 = 0; // Variable for digit mode of digit up or down
float digit = 0; //Variable value of the digit up and down
int coloum = 20; //Variable for blinking coloum cursor to show digit
int numR = 4; //number of rows
int numC = 20; //number of columns
float setTemp1 = 20; // variable for set temperature1
float setTemp2 = 40; // variable for set temperature 2
char cTemp1[10];
char cTemp2[10];
volatile int state = LOW;
lib4LCD lcd(numC,numR,12,11,4,5,6,7); //constructor lib4LCD xxx(numCols, numRows, RS, Enable, D4, D5, D6, D7)

void setup(){
delay(50);
pinMode(ledPin, OUTPUT);
delay(50);
attachInterrupt(Interrupt1, stateChange1, RISING);
delay(50);
attachInterrupt(Interrupt2, stateChange2, RISING);
delay(50);
attachInterrupt(Interrupt3, stateChange3, RISING);
delay(50);
attachInterrupt(Interrupt4, stateChange4, RISING);
delay(50);
}

void loop(){
if (mode1 ==1)
{

coloum = 3;
}

if (mode1 ==2)
{

coloum = 1;
}

dtostrf(setTemp1,6,3,cTemp1);
dtostrf(setTemp2,6,3,cTemp2);
lcd.clear();
delay(50);
lcd.print(cTemp1);
delay(50);
lcd.setCursor(0,1);
delay(50);
lcd.print(cTemp2);
delay(50);
lcd.setCursor(10,mode);
delay(50);
lcd.print(“Hello World”);
delay(50);
lcd.setCursor(coloum,mode);
delay(2000);

}

void stateChange1()
{
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
// If interrupts come faster than 200ms, assume it’s a bounce and ignore
if (interrupt_time - last_interrupt_time > 200)
{
mode = mode+1;
if (mode >= 3)
{
mode = 0;
}
}
last_interrupt_time = interrupt_time;

}

void stateChange2()
{
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
// If interrupts come faster than 200ms, assume it’s a bounce and ignore
if (interrupt_time - last_interrupt_time > 200)
{
if (mode1 ==1)
{

digit = 0.1;
}
if (mode1 ==2)
{

digit = 1;
}
if (mode ==1)
{
setTemp1 = setTemp1 + digit;

}

if (mode ==2)
{
setTemp2 = setTemp2 + digit;
}

}
last_interrupt_time = interrupt_time;

}

void stateChange3()
{
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
// If interrupts come faster than 200ms, assume it’s a bounce and ignore
if (interrupt_time - last_interrupt_time > 200)
{
mode1 = mode1+1;
if (mode1 >= 3)
{
mode1 = 0;
coloum = 20;
}
}
last_interrupt_time = interrupt_time;

}

void stateChange4()
{
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
// If interrupts come faster than 200ms, assume it’s a bounce and ignore
if (interrupt_time - last_interrupt_time > 200)
{
if (mode1 ==1)
{

digit = 0.1;
}
if (mode1 ==2)
{

digit = 1;
}
if (mode ==1)
{
setTemp1 = setTemp1 - digit;

}

if (mode ==2)
{
setTemp2 = setTemp2 - digit;
}

}
last_interrupt_time = interrupt_time;

}

Thx on advance. :wink:

I think your problem may be right here: #include <lib4LCD.h>

I took a quick look at the source code for this library and it appears that some of the required time delays may be missing. My suggestion is for you to rework your sketch to use the LiquidCrystal library that comes with Arduino v0018 and see if it works.

If it is still not working then please rework your error examples so the the expected and actual results are easier to correlate. Something like this:

Expected:  Hello, world
Actual:    @#$j*Lyu76$A

(I am using the ‘Insert Teletype’ button to get this format and you should use the ‘Insert Code’ button to make your code more readable.)

I’ll take a closer look at everything later today.

Don

Nah...you are write grumpy_mike and floresta. The problem is on the delayMicrosenconds on the LCD libraries. Thx alot. ;D