Page 1 of 1

Odd LCD behavior

Posted: Tue Aug 14, 2018 6:26 pm
by kurt_k
Hello,
I am working on a PICDEM 2 Plus Demo board. I am trying to write to the LCD using the generic LCD component. It seems to work well for the most part but if I try to write more then 10 characters (left to right), the LCD seems to jump ahead and begins writing the characters backwards and in reverse order(right to left). I saw that someone else also had an issue trying to write 16 characters to the screen but saw no resolution. The controller is a 18LF4320 is that makes any difference. I've attached the code which is really straight forward. If anyone has any suggestions or ideas as to what is happening, it would be much appreciated.


Thanks,

K

Re: Odd LCD behavior

Posted: Wed Aug 15, 2018 8:44 am
by mnf
Hi Kurt,

Try changing the LCD columns property to 16 - let us know if makes a difference

Martin

Re: Odd LCD behavior

Posted: Wed Aug 15, 2018 8:02 pm
by kurt_k
Hi Martin,
I have tried changing the columns value in the properties box. I have tried 10,16,18 and 20 with no change. I've attached a screen shot of my code with the properties window open and set to 16. I also attached the output on the LCD from my PICDEM 2 Plus board. The capture shows the reversed character in the 16th position which is incorrect. Not sure where the problem lies but I tend to think it maybe in one of the LCD component routines. Let me know if you have any suggestions or see something that I have done incorrectly.

I did change the Cursor Macro value in the previously attached code from 0x0a to 14 to help highlight the error.


Thanks,

Kurt

Re: Odd LCD behavior

Posted: Wed Aug 15, 2018 9:45 pm
by mnf
Just looking at your code again, and I think you have imported the LCD(Generic) component..

Try with the Generic (16x2) component (flags as EB005)

Martin

Re: Odd LCD behavior

Posted: Thu Aug 16, 2018 2:01 pm
by kurt_k
Hi Martin,
So I have changed the code to use the eb005 component. Changed the pin assignments in the properties box and made provisions for the R/W signal in the code. Unfortunately, the behavior is the same. I have attached a photo of the output, a screen capture and the code itself. Any ideas as to what to try next?


Thanks,

Re: Odd LCD behavior

Posted: Fri Aug 17, 2018 9:00 am
by mnf
Hi Kurt,

That's about all I can suggest... I've tried to avoid calling it a bug as it's Matrix hardware - so it 'should' work correctly...
I'd be interested to know what happens if you print a 16 char string at 0,0 ('ABCD....') - are the last characters shifted vertically up or down a row as well as reversed. It 'feels' like a counter is overflowing (ie it's a byte going > 255) at some point ( a bug in FC means that all loops get an 8 bit counter unless you use your own variable), but could be many things.
I don't have access to the library source (or to the hardware) - so would pass to Ben/Leigh for a look.

I'm also away on holiday for few days camping.... Ferry tonight, weather permitting.

Martin

Re: Odd LCD behavior

Posted: Fri Aug 17, 2018 2:14 pm
by kurt_k
Martin,
Great idea to print out 16 characters to highlight the issue. I've changed the program to output the first 16 characters of the alphabet. I've attached the updated code and the output from the screen. Again the first 10 characters appear normal. It seems that the code then jumps forward 10 spaces and begins to write the remaining characters in reverse order and backwards. Since the program is simple and uses only component routines, I can't help but think the issue is with the component routine code. Hopefully Ben or Leigh will have a chance to look at this and recommend something. I don't know how else to go other then writing the routines in a long round about way.


Thanks again for your input.

Re: Odd LCD behavior

Posted: Fri Aug 17, 2018 2:39 pm
by LeighM
Hi,
I'm not familiar with this board, but looking at some info I've just got from Microchip website seems to suggest that the LCD control lines are on RD4,5,6
So looks like RS is RD4, and Enable is RD6, R/W on RD5 will probably need to be forced low.
Hope that helps.
Leigh
ps. If I'm wrong about the pin mapping, then it's looking like the LCD controller is somewhat different to our generic component.

Re: Odd LCD behavior

Posted: Sun Aug 19, 2018 10:17 pm
by kurt_k
Hi Leigh,
Thanks for looking into this. Actually the Microchip documentation is wrong. The schematic does not match the layout or even their own documentation. The port D pin in the schematic are incorrect. The lower 4 bits of the D port are wired to the upper data pins of the LCD. A1, A2 and A3 are the control lines for Enable, Read/Write and RS prospectively. Since this board is not a Matrix product, I don't expect Matrix to look into this much more.
I was really hoping that another PICDEM board user might have seen this post, had this same issue and was able to resolve it.

Thanks for all the suggestions, I will be moving on to find another solution.

Kurt