Page 1 of 1

20x4 LCD Display

Posted: Sat Feb 07, 2009 4:52 pm
by Nick355
Hi, I seem to behaving problems with the cursor positioning on a 20x4 LCD display. So I have made a simple program to test this and it seems to the version of flowcode which makes the difference. If I compile the project with code version 3.4 it is all ok but if I compile the same project with version 3.6 the characters move to a different part of the screen which is not the cursor positions I have asked for? I have attached the two versions for you to look at. I look forward to your reply. Many thanks Nick

Re: 20x4 LCD Display

Posted: Mon Feb 09, 2009 3:02 pm
by Benj
Hello Nick

Both seem to be working fine for me. Basically your program uses the bottom line at position 18.

Where abouts are your characters ending up in the two different versions?

Re: 20x4 LCD Display

Posted: Mon Feb 09, 2009 3:57 pm
by Nick355
Hi Ben,

The version 3.4 is fine but in 3.6 ends up on bottom row position 14. To get to the bottom corner for example I have to put 23,3 for the possition, which obviously should be off the screen. It is fine in the simulation but goes wrong when I program the chip and it's on the real screen.

Re: 20x4 LCD Display

Posted: Mon Feb 09, 2009 5:14 pm
by Benj
Hello

Ok you could try the following and see if that makes any improvements for your code. Inside the Flowcode V3/Components directory is a file named LCDDisplay_Code.c

Open this file into notepad and then find the following section of code.

Code: Select all

  #if (%j == 4)
	if (y==0)
		y=0x80;
	else if (y==1)
		y=0xc0;
	else if (y==2)
		y=0x90;
	else
		y=0xd0;
  #endif
Change to

Code: Select all

  #if (%j == 4)
	if (y==0)
		y=0x80;
	else if (y==1)
		y=0xc0;
	else if (y==2)
		y=0x90;
	else
		y=0xd4;
  #endif
Restart Flowcode and hopefully your LCD should now behaive on the chip as well as in simulation.

Its possible that line 2 may also exibit the same problem. If so then change 0x90 to 0x94.

Let me know how you get on and if you spot any further inconsistencies.

Re: 20x4 LCD Display

Posted: Mon Feb 09, 2009 9:51 pm
by Nick355
That's fixed it, I did have to change the other line to fix line 2.

Many thanks for your help

Nick