16X2 LCD

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
greentech
Flowcode V4 User
Posts: 158
Joined: Mon Jan 31, 2011 2:11 pm
Has thanked: 10 times
Been thanked: 2 times
Contact:

16X2 LCD

Post by greentech »

Hi there,

I am trying to run 16x2 LCD which runs fine when i connect it with port B. but with port A the enable bit is a little problematic, all connections of LCD on port A including rs bit and enable bit does not work, but if i connect the enable bit with some other port it works fine, my hardware needs the lcd to be connected to port A, how can i resolve this?

User avatar
JohnCrow
Valued Contributor
Valued Contributor
Posts: 1367
Joined: Wed Sep 19, 2007 1:21 pm
Location: Lincolnshire
Has thanked: 364 times
Been thanked: 716 times
Contact:

Re: 16X2 LCD

Post by JohnCrow »

Hi
Using the LCD on Port A is dependant on what device you are using

I have used it on Port A with the 16F877A, but it cannot be used with the 16F88 for example

See Martins comments on a similar question I posted a while ago

http://www.matrixmultimedia.com/mmforum ... lcd#p24562
1 in 10 people understand binary, the other one doesn't !

User avatar
greentech
Flowcode V4 User
Posts: 158
Joined: Mon Jan 31, 2011 2:11 pm
Has thanked: 10 times
Been thanked: 2 times
Contact:

Re: 16X2 LCD

Post by greentech »

its 16f877a john.

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 16X2 LCD

Post by medelec35 »

Hi greentech,
RA4 is open Drain, which means you need a pull up resistor connected between RA4 and +5V.
Something like 4K7 or higher. (will only need to be lower if driving a LED)
So when RA4 is at logic 1 the output transistor is switched off, so its pin is allowed to be pulled high since it acts like an open switch.
When RA4 is at logic 0 , the output transistor is switched on so the pin is like a short circuit to GND

The odd thing is the enable is connected to RA5 by default.

If you have an LED board you can connect that up, and set port to 255 and flash at 1Hz, to check RA4 and RA5. (RA4 will be dimmer as stated above)
So if RA5 doe not light, faulty connection/chip etc. You could try continuity tests to determine this.

Martin
Martin

User avatar
greentech
Flowcode V4 User
Posts: 158
Joined: Mon Jan 31, 2011 2:11 pm
Has thanked: 10 times
Been thanked: 2 times
Contact:

Re: 16X2 LCD

Post by greentech »

I HAVE PULLED UP RA4 WITH 4K7 ALSO TRIED WITH 10K, BUT LCD DOES NOT WORK.......

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: 16X2 LCD

Post by medelec35 »

Have you toggled the the whole of port A at 1Hz and checked each pin goes from 0 to 5V and back to 0V?
Also could you have two pins shorted together?
A good way would be to create a simple light chaser.
If was me and I can't get the LCD to work on a port, then I would first confirm each pin is capable of going high then low. If it can I would concentrated on wiring between target device and LCD. I would check connections between each pin of microcontroller and LCD, for continuity, and shorts across adjacent pins.
Do you get the usual row of black squares?

I may have access to 16f877a on Monday, If so I can confirm if LCD eblock works on portA ok although I don't see why it won't.

Did You want me to take a look at your flowchart?
Although I can't see there being an issue with that.

Sorry Can't think of anything else to try.

Edit just remembered:
medelec35 wrote: Whereas with 16F877A RA0 - RA5 are bidirectional.
Although RA4 is open drain, all lines of LCD except Enable (RA5) have pull-ups.
That's why LCD works on port A
So in theory that pull-up is not necessary since the pull-up resistor is built in to LCD
Sorry about that.

Martin
Martin

User avatar
greentech
Flowcode V4 User
Posts: 158
Joined: Mon Jan 31, 2011 2:11 pm
Has thanked: 10 times
Been thanked: 2 times
Contact:

Re: 16X2 LCD

Post by greentech »

I HAVE WITTEN A VERY SIMPLE PROGRAM IN A WHILE LOOP


LCD INITIALIZE,
PRINT ASCII "HELLO WORLD" and i get the usual row of black squares :)

I Haven't tested the light chaser prog, but i will do that now and let you know the updates.

thanks for looking into the problem.

User avatar
DavidA
Matrix Staff
Posts: 1076
Joined: Fri Apr 23, 2010 2:18 pm
Location: Matrix Multimedia Ltd
Has thanked: 58 times
Been thanked: 258 times
Contact:

Re: 16X2 LCD

Post by DavidA »

Hello,

Make sure your "Start LCD" macro call is outside of the loop and is only called once at the start of the program, else you will get the black squares.

User avatar
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: 16X2 LCD

Post by Benj »

Hello,

Please can you attach your program and I will have a look for you. I'm guessing the problem is with the clock speed or config settings.
Make sure your "Start LCD" macro call is outside of the loop and is only called once at the start of the program, else you will get the black squares.
What David says is true as far as the LCD will not start up without calling the LCD Start macro in your program before sending any other commands to the display.

Any further component macro calls to the start function will have the effect of resetting and clearing the display. This can be used to recover the display in cases where interrupts or other non synchronous code is used to drive the display and the display has become corrupted due to two commands colliding.

User avatar
greentech
Flowcode V4 User
Posts: 158
Joined: Mon Jan 31, 2011 2:11 pm
Has thanked: 10 times
Been thanked: 2 times
Contact:

Re: 16X2 LCD

Post by greentech »

BENJ I SOLVED IT, AND IT SEEMS TO WORK FINE NOW. I placed a pull up resistor at RA4 and now its working fine. clockspeed and other configs were alright.

Post Reply