I have a single line 16 charactor LCD connected to my hardware. The LCD uses the standard HD44780 chip. However I when I write 16 charactors to it I only ever get the first 8. The LCD macro is set for 16x 1 line. If I hang on a 16 x 2 display, I get the correct data on the top line.
Now taking this further I note that the chip needs to be set up during initialisation to tell it if it is going to be 1 line or two line, this is set up in the
function set register. However I note that no matter which LCD size I choose from the list in the LCD module, when I look at the C code generated it always sets the function to 0x2C which is 4 bit interface, 2 lines, 5x8 dots. In other words it never selects single line display.
Can Matrix please comment on this ?
Iain
LCD Initailisation Problem
Moderator: Benj
-
iain wilkie
- Posts: 97
- Joined: Tue Jul 14, 2009 4:37 pm
- Has thanked: 13 times
- Been thanked: 9 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: LCD Initailisation Problem
Hello Iain,
Yes you are correct the code is hard coded to create 2 lines or at least to segment the memory into two sections.
You could use the custom code feature in v4 to change the hard coded command to 0x24 instead of 0x2C.
I will look into adding some code to switch this value correctly when using a single line display type.
Yes you are correct the code is hard coded to create 2 lines or at least to segment the memory into two sections.
You could use the custom code feature in v4 to change the hard coded command to 0x24 instead of 0x2C.
I will look into adding some code to switch this value correctly when using a single line display type.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
iain wilkie
- Posts: 97
- Joined: Tue Jul 14, 2009 4:37 pm
- Has thanked: 13 times
- Been thanked: 9 times
Re: LCD Initailisation Problem
Ben,
It appears that its not only the number of lines .... the other factors it seems also to make other
things "work" correctly flowcode needs to be aware of the start locations of the lines within the LCD
hardware .... ie, it appears that a single line 16 charactor display may have to be treated as 2 lines but
first line starting at 00h and second and 40h. Even using Cursor 0,2 in that instance to get to the start
of the second line does not work. Think this part of the LCD code needs a bit of an overhaul.
This seems like a good reference on all this
http://web.alfredstate.edu/weimandn/lcd ... index.html
Iain
It appears that its not only the number of lines .... the other factors it seems also to make other
things "work" correctly flowcode needs to be aware of the start locations of the lines within the LCD
hardware .... ie, it appears that a single line 16 charactor display may have to be treated as 2 lines but
first line starting at 00h and second and 40h. Even using Cursor 0,2 in that instance to get to the start
of the second line does not work. Think this part of the LCD code needs a bit of an overhaul.
This seems like a good reference on all this
http://web.alfredstate.edu/weimandn/lcd ... index.html
Iain