HD44780 Module CursorPostion on 4x20 LCD

Hi,

because my LCD is working i create a little program to drive a char with the joystick module.
I have a 4x20 display. I know about earlier problems to write line 3 and 4, because the driver only knew about 2 lines.

I tested my programm and all is fine for the first two lines. But wenn i’m driving in line 3/4 the “ball” is jumping.

Is it correct thats still a driver problem?

The problem you can see in the video:
http://youtu.be/AfJf2p8PDEI

Here is the code on codeshare:
http://www.tinyclr.com/codeshare/entry/612

Can you post on codeshare please?

Your video is marked private and I can’t watch it.

Sorry, it was too late for me yesterday.
Code is on Codeshare (Link to forum discuss is to other thread).
Video is now visible for you.

I tested the method to set cursor position and putc.
So i can reproduce the bug.

With a 4x20 LCD and this lines


Lcd.SetCursor(2,4);
Lcd.Putc((byte)'X');

The digit is showing wrong at col 0.
Whrere i can i look at the driver?

@ Suplanus - The code for the drivers can be found on Codeplex
https://gadgeteer.codeplex.com/

Specifically you can find the code for the HD44780 here
https://gadgeteer.codeplex.com/SourceControl/changeset/view/24200#256115

You can also use Reflector or JustDecompile to view the driver code from the assemblies directly. I have found that the codeplex code is not always 100% in sync with the shipping code.

I always keep an up to date working folder locally of the full Gadgeteer source from the SVN respository, it comes in handy when debugging.

@ Suplanus - I took a quick look at the code on codeplex and I am guessing (I do not have the module) the problem is here


public virtual void SetCursor(byte row, byte col)
{
  byte[] row_offsets = new byte[4] { 0x00, 0x40, 0x14, 0x54 };
  SendCmd((byte)(SET_CURSOR | row_offsets[row] | col));
}

Replace


SendCmd((byte)(SET_CURSOR | row_offsets[row] | col));

With


SendCmd((byte)(SET_CURSOR | (row_offsets[row] + col)));

1 Like