character LCD gets scrambled

Forum for problems or queries regarding other Flowcode Components. Eg LEDs, Switches, LCD, Gfx LCD etc

Moderators: Benj, Mods

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

character LCD gets scrambled

Postby hazic » Thu May 05, 2011 1:51 pm

Hi

I use 4 lines LCD, and sometimes the whole display is full of scrambled characters and it will not return to normal until I will reset the power for the controller.

I have only one thought of what can couse this but I'm not sure,
I use one INT pin that get a signal every one second, is it possible that maybe the INT is sometimes running in the middle of LCD routine and causes the problem?
do you have any other idea that can couse this?

Thanks

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8236
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2359 times
Been thanked: 3347 times
Contact:

Re: character LCD gets scrambled

Postby medelec35 » Thu May 05, 2011 2:03 pm

Hi hazic,
The way interrupt is set up or delays/components within interrupt is most likely cause.
Would you be able to post the flowchart in question assuming its not commercially sensitive?

Martin
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

Re: character LCD gets scrambled

Postby hazic » Thu May 05, 2011 5:03 pm

if that is the case (that interrupt is happenning in the middle of LCD routine) than how can I prevent it?
should I always disable INT before importent procedures and enable it again after the procedure is done?
the interupt only sets a flag

User avatar
Benj
Matrix Staff
Posts: 13983
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4247 times
Been thanked: 4008 times
Contact:

Re: character LCD gets scrambled

Postby Benj » Thu May 05, 2011 5:22 pm

Hello Hazic,

the interupt only sets a flag


If the interrupt is not calling any LCD functions then you should not have any problems. Could it be that something else is causing the I/O connected to the LCD to be controlled separately from the LCD functions.

One thing you could do in your program is replace any calls to the LCD Clear component macro with a call to the LCD Start component macro. This will effectively do the same thing but also re-synchronise the display in case it has gone out of sync.

As Medelec said would you be able to attach your program to the forums, its always much easier to troubleshoot software when its in front of you.

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

Re: character LCD gets scrambled

Postby hazic » Mon May 09, 2011 11:33 am

Thank you for your help

Ive changed the clear LCD to start LCD and for now it seems like its ok. if the problem will appear again I will post the code here.

I have another problem, I have LCD 2x8 connected to Atmega8
while its working it looks like the LCD is flickering and not working smooth.
I thought it was something in my code so I removed all the code and only left LCD start and LCD print number and the problem remains nut now it is less visible.

I will appreciate any help

User avatar
Benj
Matrix Staff
Posts: 13983
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4247 times
Been thanked: 4008 times
Contact:

Re: character LCD gets scrambled

Postby Benj » Mon May 09, 2011 12:33 pm

Hello,

It is normally best to let the LCD work like this.

Clear
Write data
Delay

The delay is required to allow the data on the LCD to be readable and not flicker.

If you must have no delay or need to run through a loop pretty fast then how about only updating the LCD say every ten times around the loop? To do this simply increment a counter inside the loop, is the counter equal to 10? If yes then clear and update display and reset counter.

An alternative to this is to avoid the usage of the clear function and simply to overwrite the values using the cursor function.

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

Re: character LCD gets scrambled

Postby hazic » Tue May 10, 2011 10:10 am

Do i have to change something for working with lcd 8*2?
If i select 16*2 or 20*2 in the componnent properties the lcd acts differently.

hazic
Posts: 24
Joined: Tue Jan 05, 2010 8:59 am
Been thanked: 1 time
Contact:

Re: character LCD gets scrambled

Postby hazic » Wed May 11, 2011 2:49 pm

the LCD component can work with 8x2 LCD?

User avatar
Benj
Matrix Staff
Posts: 13983
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4247 times
Been thanked: 4008 times
Contact:

Re: character LCD gets scrambled

Postby Benj » Wed May 11, 2011 3:28 pm

Hello,

Yes the LCD component can work with the 8 x 2 display but the coordinates you pass to the cursor function may no longer be correct.

You may have to pass coordinates like this.

0, 1

as

20, 0

Though i'm not 100% sure about this. Have a play and see if you can find out how to address the cursor correctly. Everything else should work as expected.