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: 13989
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4253 times
Been thanked: 4008 times
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Postby Benj » Mon Feb 15, 2010 2:15 pm

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

Postby ASDned » Fri Feb 19, 2010 7:55 pm

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: 13989
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4253 times
Been thanked: 4008 times
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Postby Benj » Mon Feb 22, 2010 3:27 pm

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: 13989
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4253 times
Been thanked: 4008 times
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Postby Benj » Mon Feb 22, 2010 3:28 pm

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

Postby ASDned » Mon Feb 22, 2010 6:14 pm

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

Postby ASDned » Sun May 02, 2010 11:51 am

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: 13989
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4253 times
Been thanked: 4008 times
Contact:

Re: Connecting a alphanumeric LCD to Flowcode

Postby Benj » Tue May 04, 2010 4:10 pm

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

Postby Maher » Thu Jul 10, 2014 5:14 pm

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

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

Postby medelec35 » Thu Jul 10, 2014 6:06 pm

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

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

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

Re: Connecting a alphanumeric LCD to Flowcode

Postby Maher » Thu Jul 10, 2014 11:16 pm

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?

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

Postby medelec35 » Fri Jul 11, 2014 6:50 am

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
fuse settings.png (6.58 KiB) Viewed 6798 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

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

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

Re: Connecting a alphanumeric LCD to Flowcode

Postby Maher » Fri Jul 11, 2014 8:32 pm

Thank you Martin

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

Postby medelec35 » Fri Jul 11, 2014 10:12 pm

Your welcome.
So all working now?
Martin

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

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

Re: Connecting a alphanumeric LCD to Flowcode

Postby Maher » Sat Jul 12, 2014 12:42 pm

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

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

Postby medelec35 » Sat Jul 12, 2014 1:01 pm

Hi Maher,
Have you read this:
viewtopic.php?f=5&t=9178&p=29366&#p29366

Martin
Martin

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

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

Re: Connecting a alphanumeric LCD to Flowcode

Postby Maher » Sun Jul 13, 2014 1:53 pm

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

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

Postby medelec35 » Sun Jul 13, 2014 2:19 pm

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

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

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

Re: Connecting a alphanumeric LCD to Flowcode

Postby Maher » Sun Jul 13, 2014 3:00 pm

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

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

Postby medelec35 » Sun Jul 13, 2014 3:02 pm

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

Martin
Martin

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

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

Re: Connecting a alphanumeric LCD to Flowcode

Postby Maher » Sun Jul 13, 2014 3:56 pm

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

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

Postby medelec35 » Sun Jul 13, 2014 4:25 pm

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

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

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

Postby medelec35 » Sun Jul 13, 2014 9:04 pm

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

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