Odd LCD behavior

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
kurt_k
Posts: 10
Joined: Wed Dec 13, 2017 2:37 am
Has thanked: 1 time
Been thanked: 2 times
Contact:

Odd LCD behavior

Post 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
Attachments
LCD_code.fcfx
(9.39 KiB) Downloaded 368 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Odd LCD behavior

Post by mnf »

Hi Kurt,

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

Martin

kurt_k
Posts: 10
Joined: Wed Dec 13, 2017 2:37 am
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: Odd LCD behavior

Post 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
Attachments
program with properties in view
program with properties in view
Screen shot.jpg (65.65 KiB) Viewed 8460 times
actual LCD output
actual LCD output
Output.jpeg (82.08 KiB) Viewed 8460 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Odd LCD behavior

Post 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

kurt_k
Posts: 10
Joined: Wed Dec 13, 2017 2:37 am
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: Odd LCD behavior

Post 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,
Attachments
LCD_code.fcfx
(8.72 KiB) Downloaded 364 times
eb005_output.jpg
eb005_output.jpg (78.77 KiB) Viewed 8441 times
output_eb005.jpeg
output_eb005.jpeg (51.57 KiB) Viewed 8441 times

mnf
Valued Contributor
Valued Contributor
Posts: 1188
Joined: Wed May 31, 2017 11:57 am
Has thanked: 70 times
Been thanked: 439 times
Contact:

Re: Odd LCD behavior

Post 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

kurt_k
Posts: 10
Joined: Wed Dec 13, 2017 2:37 am
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: Odd LCD behavior

Post 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.
Attachments
Code output.jpeg
Code output.jpeg (101.56 KiB) Viewed 8414 times
LCD_code.fcfx
(8.73 KiB) Downloaded 385 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Odd LCD behavior

Post 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.

kurt_k
Posts: 10
Joined: Wed Dec 13, 2017 2:37 am
Has thanked: 1 time
Been thanked: 2 times
Contact:

Re: Odd LCD behavior

Post 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

Post Reply