LCD test program works on simulator,

Moderator: Benj

Post Reply
User avatar
CRAIG CHAMBERLAIN
Flowcode V4 User
Posts: 24
Joined: Mon Jun 27, 2011 6:05 am
Location: Madison Wisconsin
Has thanked: 6 times
Contact:

LCD test program works on simulator,

Post by CRAIG CHAMBERLAIN »

But not on my Ql200 board. But it seems to be trying, the data
lines are toggling to port b, but except for the back light. it's blank.
I did run the 1 led blinker at 1hz test, on the sim and on the QL200,and the clock *seems* OK.
It was blinking at the same rate as the sim.
The Sheep counter exercise in the tutorial counted via a led bank. That program ran on the QL200 as well.
Just not the LCD.

Enclosed is the hex program used.
I have a 16f887A Processor and a 4Meg Xtal
-Thanks,
Craig
Attachments
XT CLOCK SHEEP COUNT LCD.hex
(3.66 KiB) Downloaded 385 times

User avatar
Steve
Matrix Staff
Posts: 3418
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: LCD test program works on simulator,

Post by Steve »

It sounds like a config issue, but you have done the right first step in determining that the clock is running at the expected frequency.

There are 2 other things to look out for in the config word(s) - make sure the WDT is off; and also try with LVP off too (if LVP is on, one of the pins on portb will be unavailable as an i/o line).

Failing that, it could be something simple like you have not included the "LCD::Start" macro at the beginning of your program. Of you have the connection pins wrong for the LCD within Flowcode.

Hopefully one of the above will point to the error. If not, I don't know what it could be.

User avatar
CRAIG CHAMBERLAIN
Flowcode V4 User
Posts: 24
Joined: Mon Jun 27, 2011 6:05 am
Location: Madison Wisconsin
Has thanked: 6 times
Contact:

Re: LCD test program works on simulator,

Post by CRAIG CHAMBERLAIN »

Steve,

"Of you have the connection pins wrong for the LCD within Flowcode".

I have set the options of LVP, WDT, etc set "off". or disabled. so that shouldn't be an issue.
Also I do have the "Start LCD" command in place, and as I said, it is working on the Sim.
But on assigning the port pins I was off. In trying to correct pin assignments in Flowcode,
I could not figure out how to connect the pins that aren't covered in the LCD component connections.
I need to assign 7 data lines on port D. RS, R/W and E on Port A. The LCD connections screen allows me to connect
D0 - D3. Also RS to RA1 and E to RA3 but have no way to connect D4-D7 and R/W.

I must be missing something basic.
-Craig
Attachments
XT CLOCK SHEEP COUNT LCD.fcf
Flowcode program attached.
(7 KiB) Downloaded 398 times

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

Re: LCD test program works on simulator,

Post by medelec35 »

CRAIG CHAMBERLAIN wrote: In trying to correct pin assignments in Flowcode,
I could not figure out how to connect the pins that aren't covered in the LCD component connections.
I need to assign 7 data lines on port D. RS, R/W and E on Port A. The LCD connections screen allows me to connect
D0 - D3. Also RS to RA1 and E to RA3 but have no way to connect D4-D7 and R/W.

I must be missing something basic.
-Craig
Hi Craig,
LCD can work in two different types of modes. 8-bit mode and 4-bit mode.
If I have read your reply correctly,it sounds like you are trying to wire up LCD in 8-bit mode?

Flowcode LCD component only works in 4-bit mode.
In this mode only the 4 upper data lines are used.
On your LCD hardware only connections D4 - D7 are connected.
D0 - D3 are left open circuit.
Finally R/W connection on your hardware is just shorted to 0V, so does not connect to any pins of microcontroller
So in total your LCD should only be connected to a total of 6 pins of your target device.
See diagram below of EB005 LCD Eblock:
LCD Connections.png
(30.49 KiB) Downloaded 8770 times
When you use the LCD component:
Data1(of Flowcode LCD component) is D4 connection of your LCD hardware
Data2 is D5 connection of your LCD hardware
Data3 is D6 connection of your LCD hardware
Finally Data4 is D7 connection of your LCD hardware

Normally if the whole of port B for example is bidrectional, then the LCD can just be connected to just 1 port and it will work just fine. So long as the target device is running at correct speed. The flashing 1Hz test can determine this, which you have already done.
Hope this helps.

Martin

Edit, changed 'a total of 5 pins' to 'a total of 6 pins'
Thanks Dan for spotting typo
Last edited by medelec35 on Sun Nov 06, 2011 11:00 am, edited 1 time in total.
Martin

User avatar
Dan81
Valued Contributor
Valued Contributor
Posts: 268
Joined: Sun Jan 15, 2006 4:07 pm
Location: Albi France
Been thanked: 60 times
Contact:

Re: LCD test program works on simulator,

Post by Dan81 »

Hello Craig

Matrix LCD component uses 4bits mode , only DB4-DB7 (and E and RS).
And then you can use only 6 bits in stead of 10 for managing a LCD.
R/W must be connected to GND. (DB0-DB3 no connected or to GND, never mind).

You can find the connections in the "help" (Ext properties / Help) or in any LDC datasheet .

Note :
- When you read the sensor (switch) , you are reading the entire port. That could affect LCD (but not in this case).
You can move RS and E to port D
- If Switch stays actived, Count will be incremented.


Daniel

sorry Martin for the double posting
Attachments
COUNT_LCD2.fcf
(7 KiB) Downloaded 420 times
Last edited by Dan81 on Sun Nov 06, 2011 11:39 am, edited 1 time in total.

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

Re: LCD test program works on simulator,

Post by medelec35 »

Hi Craig.

I have had a look at the datasheet for QL200, and altered your flowchart accordingly
I have not got a QL2000 to test, so I can't guarantee it will work OK.
I believe you will need to move switch S10_4 to the ON position Since on 16f887A, RA4 is open drain and moving switch, pulls
RA4 high via a pull-up resistor, until a low o/p is required.
I have removed the switch i/p on port A since that will also stop LCD working (R/W has to stay at 0V).
If you let me know the connection of the switch you are using, I can add on to flowchart.
It would be a good idea just to get LCD to work at this stage.
Dan81 wrote:
sorry Martin for the double posting
No problem at all.
Its so easy to type two replys at the same time. But you want to post after you see the message about a post has been made..etc. Since the time it has taken to compile (I have done this a few times myself!)
Besides two posts are better than none any day!

Martin
Attachments
XT CLOCK SHEEP COUNT LCD Modified for QL200.fcf
(6.5 KiB) Downloaded 400 times
Martin

User avatar
CRAIG CHAMBERLAIN
Flowcode V4 User
Posts: 24
Joined: Mon Jun 27, 2011 6:05 am
Location: Madison Wisconsin
Has thanked: 6 times
Contact:

Re: LCD test program works on simulator,

Post by CRAIG CHAMBERLAIN »

Martin & Steve,
Thanks for your input to date, it has been very helpful.
I must be very close to getting it now.
I was using incorrect pin assignments. All the data pins were wrong.
The switch has been been re-assigned to RB0 only on Port B.
RA4 is pulled up.
I even tried pulling the chip, putting it on the EB-006 Multiprogrammer, and programed it,
and put it back in the QL200, with the same result.

I am getting warnings during programming, so I will attach them.
It still will run the binary LED'S count version of this, so I'm lost.
TIA,
-Craig
Attachments
COMPILER WARNINGS.jpg
COMPILER WARNINGS
(202.07 KiB) Downloaded 4064 times
XT CLOCK SHEEP COUNT LCD.fcf
CURRENT FLOWCODE FILE
(8.5 KiB) Downloaded 396 times

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

Re: LCD test program works on simulator,

Post by medelec35 »

Hi Craig,
When you get warnings about ' unreferenced functions removed:'
or Caution: argument of 'delay_10us' calls must have a value of 1 or more
They are nothing to worry about.
For instance :

Code: Select all

Warning unreferenced functions removed:

	 FCI_FLOAT_TO_STRING	 in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h

	 FCI_NUMBER_TO_HEX	 in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h

	 FCI_STRING_TO_INT	 in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h

	 FCI_STRING_TO_FLOAT	 in: C:\Program Files (x86)\Matrix Multimedia\Flowcode V4\FCD\internals.h
Just means you did not use the FLOAT_TO_STRING or NUMBER_TO_HEX or STRING_TO_INT or STRING_TO_FLOAT functions, so they have been removed.
I think those warnings are a bit illogical, since we created the flowchart so we know what we did or did not use :lol:
But developers of BoostC must have there reasons, and they could be there for an important purpose?
CRAIG CHAMBERLAIN wrote: I was using incorrect pin assignments. All the data pins were wrong.
That is correct since now your pin assignments are now the same as the flowchart I attached.
The only thing I can see missing is you have not got a single RA2 output set to 0.
I placed that at the beginning of my flowchart :
RW Line must be set to 0V.png
(7.18 KiB) Downloaded 8734 times
The purpose of setting RA2 (connected to LCD R/W on QL200 board) to 0V is your R/W which must be connected to ground (0V) in order for your display to work.

As for the delay warning, again nothing to worry about. Should not affect your program at all.
Martin
Martin

User avatar
CRAIG CHAMBERLAIN
Flowcode V4 User
Posts: 24
Joined: Mon Jun 27, 2011 6:05 am
Location: Madison Wisconsin
Has thanked: 6 times
Contact:

Re: LCD test program works on simulator,

Post by CRAIG CHAMBERLAIN »

Martin,
I tried your program with the same results, no output, even garbage or otherwise.
I had pulled RA2 to ground. The QL200 has jumpers to connect or disconnect the
display pins to the ports. I pulled the jumper to RA2 off, and connected the display side of
the the jumper pins RA2 (R/W) by wire to ground.

So my hardware connections are as follows,
1 NC
2 RS TO RA1
3 R/W TIED TO GND
4 ENABLE TO RA3
5 NC
6 NC
7 D0 TO RD4
8 D1 TO RD5
9 D2 TO RD6
10 D3 TO RD7
11-14 NC
10 D3 TO RD7

All the options like BODEN, LVP, WDT, are turned off. RA4 is pulled high.
I have checked continuity of all connections from LCD to PIC.
I just went through every pin with my scope, and found all data and control pins toggling (except R/W).
After not seeing so much as garbage on the display, I think it's getting pretty safe to start suspecting the LCD.
I do have A graphics display. LCD12864.
I could try that. Any easy test code out there to test that display? is that using a 8 bit word?
Or other input on this display?
-Craig

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

Re: LCD test program works on simulator,

Post by medelec35 »

Hi Craig,
What about the bias control for LCD contrast?
With an uninitialised display (would be if timing or pin connections are wrong) Within Flowchart just to test for this you can temporary remove LCD start component, then sending to target. Don't forget to add lcd start back in your flowchart and resend to target after test.
By altering the bias voltage, the contrast should alter enough to produce a row of black squares
If you cannot see a row of squares then either 5V, 0V Or bias is missing.
Normally bias( 0 to 5V) is from the wiper of a pot that’s connected across 5V supply.

However I have used 1 type of LCD that required a small negative bias voltage.

Martin
Last edited by medelec35 on Wed Nov 09, 2011 11:12 pm, edited 1 time in total.
Martin

dbasnett
Posts: 125
Joined: Mon Aug 15, 2011 1:54 pm
Has thanked: 8 times
Been thanked: 11 times
Contact:

Re: LCD test program works on simulator,

Post by dbasnett »

@craig - Nice avatar ;)

User avatar
CRAIG CHAMBERLAIN
Flowcode V4 User
Posts: 24
Joined: Mon Jun 27, 2011 6:05 am
Location: Madison Wisconsin
Has thanked: 6 times
Contact:

Re: LCD test program works on simulator,

Post by CRAIG CHAMBERLAIN »

I do get a top row of filled segments when i crank up the contrast.
-craig

User avatar
CRAIG CHAMBERLAIN
Flowcode V4 User
Posts: 24
Joined: Mon Jun 27, 2011 6:05 am
Location: Madison Wisconsin
Has thanked: 6 times
Contact:

Re: LCD test program works on simulator,PROBLEM SOLVED!

Post by CRAIG CHAMBERLAIN »

Martin,
First I re-connected the write line as it was toggling, and I thought maybe it need that. It did. No it doesn't make sense.
It also needed the one piece of code then that you supplied making the RA2 R/W line low.
Now I have a working LCD.
Thanks for your help!
-Craig

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

Re: LCD test program works on simulator,

Post by medelec35 »

Glad you have a working LCD now.
Thanks for letting us know.

Martin
Martin

Post Reply