Connecting a alphanumeric LCD to Flowcode

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

Moderators: Benj, Mods

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: Connecting a alphanumeric LCD to Flowcode

Post by Benj »

Hello

You may need to check your project options to ensure you are running at the correct clock speed. If you have the HS mode selected and features like the watchdog and the LVP disabled then this should be correct for your setup.

8-bit communications is possible by using the code customization features of Flowcode v4. Though 8-bit communications is generally throwing away i/o for little gain.

ASDned
Posts: 6
Joined: Tue Sep 08, 2009 12:08 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by ASDned »

Hello BenJ,

I disabled the watchdog and the low power programming, but still nothing... I did look in the C code and the cristal is 12Mhz. With a scope I checked the pins and there is a 5 Volt puls on all 6 pins. Is there a slow reset problem that you know of?

Thanks fos the advice.
ASDned

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: Connecting a alphanumeric LCD to Flowcode

Post by Benj »

Hello

The code should be working ok unless you have a damaged LCD module.

Here are the main causes for problems with an LCD.

Incorrect clock speed - Create a simple program that flashes an LED with 1second delays. This confirms if you have the clock speed correct in Flowcode.

Incorrect configuration - Create a simple program that flashes an LED with 1second delays. This confirms if you have the configuration correct in Flowcode.

Incorrect wiring / connections - Check that the data pins in Flowcode go to the high nibble of the data bus on the LCD.

If you have the low voltage programming configuration enabled then you will loose an I/O pin normally right in the middle of PortB.

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: Connecting a alphanumeric LCD to Flowcode

Post by Benj »

Hello

The code should be working ok unless you have a damaged LCD module.

Here are the main causes for problems with an LCD.

Incorrect clock speed - Create a simple program that flashes an LED with 1second delays. This confirms if you have the clock speed correct in Flowcode.

Incorrect configuration - Create a simple program that flashes an LED with 1second delays. This confirms if you have the configuration correct in Flowcode.

Incorrect wiring / connections - Check that the data pins in Flowcode go to the high nibble of the data bus on the LCD.

If you have the low voltage programming configuration enabled then you will loose an I/O pin normally right in the middle of PortB.

PortA Pin 4 cannot source current on quite a few PICmicro devices.

ASDned
Posts: 6
Joined: Tue Sep 08, 2009 12:08 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by ASDned »

Hello Ben,

I did a measurement wiyh a frequention counter amd measured a stable 20Mhz instead of the 12Mhz it should be (in the manual and on the xtal). I changed it in the software and flashed again but still nothing... so I made a led burn for 60 seconds and timed it and it is exact 60 seconds so no brain waves about that anymore. I did check the wires again and again so I think also that the LCD is corupted. I wil let you know wath it was.

Hear from me soon,
ASDned

ASDned
Posts: 6
Joined: Tue Sep 08, 2009 12:08 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by ASDned »

Hello ben,

I was bizzy with exams but in some spare time I did try the following. I have used the MicroC Pro and programmed the LCD demo and it did work straight away. So it is somethimg in the timing to the LCD and Flowcode with this board I use. If I am right this is a problem for more Flowcode users?

Best regards,
Boris.

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: Connecting a alphanumeric LCD to Flowcode

Post by Benj »

Hello Boris,

Any chance you can send me your Flowcode file and I will look into this for you and see if I can spot anything further.

Maher
Posts: 9
Joined: Fri Jul 04, 2014 1:10 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by Maher »

Hi everybody
I face problem with LCD it's just light and don't display any char
I am use Pic16f877a with config word 0x393a
simulation ok but when I run my device that's what happen
Image

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: Connecting a alphanumeric LCD to Flowcode

Post by medelec35 »

Hi Maher,
What you are seeing is an uninitialized LCD.
Either:
1) LCD connections wrong, Open or short circuit.
Here is how LCD Eblock is wired up (page 7), which may help.
2) Flowchart chip configuration is wrong. E.g watchdog, low voltage programming enabled
3) Hardware has an issue e.g crystal or associated components faulty.
MCLR is enabled, but on hardware is not tied to + supply

My advice would be to connect a resistor & LED and make a 1Hz flasher.
See this link

If you're not sure about flowchart settings, if you post you're flowchart then I can have a look at it for you.
A circuit diagram may help.

Martin.
Martin

Maher
Posts: 9
Joined: Fri Jul 04, 2014 1:10 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by Maher »

Thank you Martin
I check circuit no short or open circuit and the Flowchart chip configuration is right (0x393A) and another
look these photosImage
this configuration in Topwin 2005 programmer
Image
and the simulation run without problems
Image
this is the code
http://up.top4top.net/downloadf-top4top ... 1-rar.html
what should i do?

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: Connecting a alphanumeric LCD to Flowcode

Post by medelec35 »

Hi Maher,
Maher wrote: this configuration in Topwin 2005 programmer
The programmer is not reading fuses correctly yet config value looks correct.
How odd?
WDTEN and LVP must not be selected
When I load your hex file with my programmer:
fuse settings.png
(6.57 KiB) Downloaded 8763 times
Since with your programmer LVP is enabled that alone will stop LCD from working.

So you can test hardware you can always manually change the fuse settings on your programming software to match configuration settings of flowcode.
Martin

Maher
Posts: 9
Joined: Fri Jul 04, 2014 1:10 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by Maher »

Thank you Martin

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: Connecting a alphanumeric LCD to Flowcode

Post by medelec35 »

Your welcome.
So all working now?
Martin

Maher
Posts: 9
Joined: Fri Jul 04, 2014 1:10 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by Maher »

Hi Martin
yes it is working but there is another problem when i want use keypad it is take number without press any key ( the connection of keypad is c1:PortD4
c2:PortD5
c3:PortD6
rowA:portC4
rowB:PortC5
rowC:PortC6
rowD:PortC7)
I connect terminal of keypad without resistor between them and pins of micro

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: Connecting a alphanumeric LCD to Flowcode

Post by medelec35 »

Hi Maher,
Have you read this:
http://www.matrixtsl.com/mmforums/viewt ... 66&#p29366

Martin
Martin

Maher
Posts: 9
Joined: Fri Jul 04, 2014 1:10 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by Maher »

Thank you Martin
yes I should use pull down resistors
can you help me
I use SY_HS_220 Humidity sensor
PIC16f877A : ADC(1) for humidity sensor
ADC1_VALUE:ReadAsInt()
HUMIDITY = (ADC1_VALUE * 5.0 * 33.0) / 1024.0
in data sheet of sensor the output voltage is 2970mv for 90%RH
And 990mv for 30%RH
(2970-990)/(90-60)=33
but when I read the value of humidity from sensor it upper than 120%RH
where is my mistake
and thank you very much

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: Connecting a alphanumeric LCD to Flowcode

Post by medelec35 »

Hi Maher,
Your calculations will cause issues if not using floats:
Take a look here
That should help,
Unless you're using floats as I can see you have a .0 at the end of each number.
If you can post a flowchart, I can have a look at it for you.

Edit just a thought.
Try this:
Using ReadAsInt
and Humidity variable as an Byte (saves ROM).
Within a calculation box:
HUMIDITY = ADC1_VALUE * 7 / 50 + 5

Martin
Martin

Maher
Posts: 9
Joined: Fri Jul 04, 2014 1:10 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by Maher »

Hi Martin
I used Floating point variable (HUMIDITY)
ADC1_VALUE (integer)
look that
Image
and the character of sensor is
Image

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: Connecting a alphanumeric LCD to Flowcode

Post by medelec35 »

Hi Maher,
Try with the formula I posted above without using floats.

Martin
Martin

Maher
Posts: 9
Joined: Fri Jul 04, 2014 1:10 pm
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Post by Maher »

can you explain why use this formula
Using ReadAsInt
and Humidity variable as an Byte (saves ROM).
Within a calculation box:
HUMIDITY = ADC1_VALUE * 7 / 50 + 5

Martin

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: Connecting a alphanumeric LCD to Flowcode

Post by medelec35 »

It's a formula I made up to give and approx humidity reading for a give i/p voltage.
But I have made a mistake I used min Humidity of 33% and not 30%
So instead of HUMIDITY = ADC1_VALUE * 7 / 50 + 5
Then use ADC1_VALUE * 3 / 20

e.g
For H30% datasheet shows V= 0.990V
ADC variable will be 1023/5*0.990 = 201 (rounding down)
put that into the formula & rounding down:
Humidity = 201 * 3 / 20 = 30

For H90% datasheet shows V= 2.970V
ADC variable will be 1023/5*2.970 = 607 (rounding down)
put that into the formula & rounding down:
Humidity = 607 * 3 / 20 = 91

Not far off.

It's not worth using the memory hungry floats if there is no precision involved, e.g just in table form:
30 = 990
40 = 1300
etc.

Martin
Martin

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: Connecting a alphanumeric LCD to Flowcode

Post by medelec35 »

How did you get on with the new formula?

I'm going to move part of this thread, as we are posting in the wrong section.
So its moved to the correct section, what verson of flowcode are you using?
E.g V4, V5
Free, Home or Professional?
Martin

Post Reply