PDA

View Full Version : [MuIn LCD] problem with clear screen or move cursor with last firmware



andromeda
05-12-10, 12:16
Hi,

there is a problem with command move cursor on arduino mega 2560.

in the section loop i do:

clear screen
move cursor to line 3
and print 20 caractere in the line3

problem => cursor position is after un moment line1, after line 3, after line 1 etc..

may be is a timing problem with move cursor or clear screen because command clear screen position a cursor in line 1, but i have tested whithout clear command only movecursor and the cursor position is line 1,2,3,4 after a moment.

Where is a problem?

video http://www.youtube.com/watch?v=3-csbGejOuY

the code:





int i;

void setup()
{
Serial2.begin(57600);
}

void loop()
{
clear();
move(3,1);
for (i = 0; i < 20; i++)
{
printchar(4);
delay(40);
}

}

void changeBaud()
{
Serial2.write(0xFE);
Serial2.write(0x39);
Serial2.write(0x01);
delay(3);
}

void clear()
{
Serial2.write(0xFE);
Serial2.write(0x58);
delay(3);
}

void graphinit()
{
Serial2.write(0xFE);
Serial2.write(0x68);
delay(3);
}

void bargraph(byte col, byte row, byte dir, byte length)
{
Serial2.write(0xFE);
Serial2.write(0x7C);
Serial2.write(col);
Serial2.write(row);
Serial2.write(dir);
Serial2.write(length);
delay(3);
}

void printmsg(char *msg)
{
Serial2.print(msg);
}

void printchar(char c)
{
Serial2.print(c);
}

void move(byte row, byte col)
{
Serial2.write(0xFE);
Serial2.write(0x47);
Serial2.write(row);
Serial2.write(col);
delay(3);
}

Astrobeed
06-12-10, 12:59
I'm trying your code on Arduino 2009, let you know as soon as possible because you get this problem.

Bye

andromeda
07-12-10, 19:39
i have tested from other code for arduino and movecursor have problem, the parmaters from cursor move are bad when i want to put it at row or col to lcd.

Astrobeed
08-12-10, 16:15
attached the update to version 2.2.4 of the firmware.


http://www.youtube.com/watch?v=VSnmYT3F2jI

I did the test with this sketch, is a bit more complex.



void setup()
{
Serial.begin(19200);
}
int i;
void loop()
{
clear();
for (i = 1; i < 101; i++)
{
bargraph(1,4,0,i);
move(3,i/5);
if(i>5) printchar(4);
move(2,10);
Serial.print(i);
move(1,5);
Serial.print(i);
move(1,15);
Serial.print(i);
delay(5);
}
}
void changeBaud()
{
Serial.write(0xFE);
Serial.write(0x39);
Serial.write(0x01);
delay(3);
}
void clear()
{
Serial.write(0xFE);
Serial.write(0x58);
delay(5);
}
void graphinit()
{
Serial.write(0xFE);
Serial.write(0x68);
delay(3);
}
void bargraph(byte col, byte row, byte dir, byte length)
{
Serial.write(0xFE);
Serial.write(0x7C);
Serial.write(col);
Serial.write(row);
Serial.write(dir);
Serial.write(length);
delay(5);
}
void printmsg(char *msg)
{
Serial.print(msg);
}
void printchar(char c)
{
Serial.print(c);
}
void move(byte row, byte col)
{
Serial.write(0xFE);
Serial.write(0x47);
Serial.write(row);
Serial.write(col);
delay(3);
}

andromeda
08-12-10, 21:09
Yes, thank you is ok, graph work and move cursor work.