LCD not working on my project Hardware

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

LCD not working on my project Hardware

Post by JLeith »

Hello All
Just before I lose it I need a fresh look at what is happening to my LCD display

I loaded my PIC with another program and the LCD worked.
Only Difference it used Port C pins

The Program that won' display is using Port D

The program runs in Flowcode.

I cant see why PORT 5 won't work in the Hardware state.

Hope someone can load the Flowcode and has a LCD to try.

Don't need any inputs the LCD show read 'MOSQUITO" on power up.
PIN A7 should be LOW for 'Mosquito" and High for "Pee Wee"

Attatched is The LCD drawing and Flowcode

The only think left is to rewrite my program with only a LCD output and see if that works.

But I will hold that thought encase someone can see what I have missed.

John
Attachments
LCD wirking
LCD wirking
Pitch Count Master LCD.jpg (56.75 KiB) Viewed 12103 times
Last edited by JLeith on Tue Mar 22, 2016 7:59 pm, edited 1 time in total.

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Opps I missed the Oscillator was not on Internal

Here is a New FLowcode. Still not working

John
Attachments
Pitcher count Master.fcfx
(96.86 KiB) Downloaded 271 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 not working on my project Hardware

Post by medelec35 »

Hi John,
You have still got an issue with your configuration settings and possibly osccon setting as well!
If you enter F0 in a calculator that converts to binary it will show:
osccon value.png
(47.8 KiB) Downloaded 7042 times
As you can see from the data sheet if checking what 11110000 does to osccon:
from MSB
1 = Enable PLL no mater whether is enabled or not = 4x osc frequency.
1110 = 8Mhz (4x8 = 32MHz)
0 = unimplemented
00 = allow osc selection from configuration settings = set for internal osc

So unless you set clock frequency to 32MHz or change osccon value LCD will not work as all the timings will be out by
(32-19.6) /32 x 100 = 38% error.
Too much for the LCD to work!

So with current osccon value of 0xF0 you must set clock speed to 32MHz for LCD and your project to work.

Also MCLR is enabled so have you got a resistor going from MCLR to +5V?

Martin
Martin

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Martin thank you for your knowledge.

I tried to follw the design we worked on with The Servo and displays.

I readjusted the timing from 8Meg to 32Meg and it is running.

Now my next hurdle is the LCD I had in my parts box turns out to be a parallel LCD not a Serial like we used in the Servo design

The Serial uses 4 Data and the Parallel needs 8 Data ?

I did place an order for 2 new Serial LCD.

Martin is there a way to add a Parallel LCD to Flowcode ? Just a thought if I had these 2 LCD's

John

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

I have the Serial LCD working

What I did was Disable my SPI ( Wireless programming )

I don't know how the code messed up my LCD. It like it was frozen.

Martin are you familure with the SPI interface.

Here is my Flowcode with the SPI actions disabled

Martin could you look over my SPI code ?

John
Attachments
Pitcher count Master.fcfx
(97.14 KiB) Downloaded 265 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 not working on my project Hardware

Post by medelec35 »

Hi John,
Sorry not had any dealings with SPI LCD
So will not be able to assist with that.

Martin
Martin

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: LCD not working on my project Hardware

Post by GTF »

Hi John,

Should your first disabled SPI macro be "Initialize" rather than "Uninitialize"? What SPI device are you sending data to?

Grant in Winnipeg

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Hello Grant,
Yes the SPI macro is off line at the moment. I had issues with the LCD and it turned out that the LCD is a 8 BIT and I have 4 BIT.

I thought my program was crashing but it was the LCD.

I hope to get back to SPI this weekend.

I plan on using wireless TX / RX ( NFR905 )

First thing I'm going to try is connecting the PIC's via Hardwire to ensure they communicate. I'm not 100% sure on how to collect the info at the slave side.

Here is a picture of my thoughts for TX.

Grant have you worked with Wireless Transmission ?
Attachments
PIC to NFR905 1 way.jpg
PIC to NFR905 1 way.jpg (47.53 KiB) Viewed 11990 times
NRF905.jpg
NRF905.jpg (28.68 KiB) Viewed 11990 times

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: LCD not working on my project Hardware

Post by GTF »

No I have not had a chance to play with it yet. Have used SPI though. Just wanted to clarify what the SPI device was and find the datasheet:
http://www.nordicsemi.com/eng/content/d ... 5_v1.5.pdf Haven't looked closely at your FC or the datasheet yet but I had issues with the SPI clock phase description...having to select the opposite of what I thought I needed according to the datasheet. Although I don't think that would cause a lockup, just prevent receipt of the data.

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Hi Grant
I have printed off the PDF ealier 80 sum pages. Staples copy cantre helped.

My NFR905 are sceduled to be here around April 5th then I can give it a try.

I enjoy FC projects it keeps my retired brain sharp.

Sometimes it slips. Missed the clock speed.

I'm trying to find 16X2 (4 bit) LCD for a reasonable price. Here in Vancouver they run about $30 each. I did buy a couple on Ebay for $7 but they don't have any left.

On the comment "You have used SPI" did you do it via wirless or direct ?

Off to build the PCB.

John

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: LCD not working on my project Hardware

Post by Benj »

Hi John,

From my student days I used to buy from here and they have a good selection of LCDs available which should work in the 4-bit mode.

http://www.futurlec.com/LCDDisp.shtml

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Thank you Benj for the link

Here is what I think is the 4 Bit.

Benj in the world of LCD is it the Controller ( HD44780 or other) that converts 4 bits to 8 bits internal

John
Attachments
LCD16X2BL.jpg
LCD16X2BL.jpg (42.19 KiB) Viewed 11951 times

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: LCD not working on my project Hardware

Post by GTF »

No wireless. The datasheet link was for my own(and others') reference.

I have been using LCDs from China, with or without the I2C adapters. FC has a prebuilt I2C LCD component that works nicely with the 1602 I2C adapters.
Free shipping(be prepared to wait 1 month). No taxes or duties if the total value is under $20 CAD.(seems to be the case even when the actual value is not).

http://www.dx.com/p/lson-fm1602c-lcd-module-301616
http://www.dx.com/p/lcd1602-adapter-boa ... rds-216865
http://www.dx.com/p/funduino-iic-i2c-16 ... red-173588

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Hi Grant
Thank you for the link

Yes the Month is terrible from China and they say they are shipping by Air Mail. Guess slow planes.

I did order my NFR905 wireless form DX. DX is in China and they say I should be expecting in 22 days but 30 is the norm.

So when you did your SPI it was via wire from MISO to MOSI with clock ?

John

GTF
Posts: 170
Joined: Sat Dec 10, 2011 7:21 pm
Location: Canada
Has thanked: 20 times
Been thanked: 52 times
Contact:

Re: LCD not working on my project Hardware

Post by GTF »

Yes SPI 3/4 wire.....MOSI/MISO, CLK and CS/SS.

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: LCD not working on my project Hardware

Post by Benj »

Hi John,
Benj in the world of LCD is it the Controller ( HD44780 or other) that converts 4 bits to 8 bits internal
Yep the LCD needs 8-bit commands but supports 2 x 4-bit operation to clock in the 8-bit command. From the HD44780 datasheet.
The HD44780U can send data in either two 4-bit operations or one 8-bit operation, thus allowing interfacing with 4- or 8-bit MPUs.
https://www.google.co.uk/url?sa=t&rct=j ... yQ&cad=rja

We use the 4-bit mode by default in Flowcode but the "LCD (Generic)" component available from the search category allows the 8-bit data mode. The 8-bit mode can be useful for faster display operations at the cost of 4 extra I/O pins.

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Thank you Beji

I'm using the PIC16F1937 ( 40 Pins )
With a Quad 7 segment ( 12 PINS )
6 switch inputs (6 PINS)
SPI ( 3 PINS )
PWR/GRD ( 4 PIns )

Down to 1 Spare pin

Benj in the Speech Output is there a link to hear what the 'Phoneme Selection" sounds like ?

John

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: LCD not working on my project Hardware

Post by Benj »

Hi John,

If you download the speech example from here then it should simulate on your PC when you hit play and show you what it sounds like.

http://www.matrixtsl.com/wiki/index.php ... de5f9b41a8

It's not amazing but it does work. Think 90's style talking watches or 80's style talking robots.

I should have the Phoneme sequences for all the numbers somewhere 0-9 and then ten, twenty etc. I'll have a dig and see if I can find them.

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: LCD not working on my project Hardware

Post by Benj »

Found it, a talking volt meter :)

Actually working very well converted to v6 and running in the simulation. Just hit play and press the switch on the panel to take a reading.
Voice Meter_v6.fcfx
(25.76 KiB) Downloaded 238 times
I've added this to the Wiki now too as it's a great working example. My work PC stutters a bit between Phonemes but this is not there on the hardware.

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Odd

I have a new laptop and for some reason it sounds like a "ROBOT" that needs new batteries ?

Maybe I just need a tone the audio is ruff.

Benj what format is the phoneme ?

If I recall back in FC 5 was there not a more 'English" audio ?

John

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Benj

Where do I get this Speech pattern ?

I was google searching to learn more on 'Phoneme" and found this Flowcode 6 page.
http://www.matrixtsl.com/wiki/index.php ... de5f9b41a8

And it has a Flowcode 6 example ( Speech 2 )

John
Attachments
Speech2.fcfx
(9.48 KiB) Downloaded 179 times

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: LCD not working on my project Hardware

Post by Benj »

I have a new laptop and for some reason it sounds like a "ROBOT" that needs new batteries ?
Yep that sounds about right. You can change the pitch property to alter the sound a bit.
Benj what format is the phoneme ?
The phoneme's are in simple unsigned byte format we simply queue them up in a audio buffer and then stream them out using a DAC or PWM.
If I recall back in FC 5 was there not a more 'English" audio ?
Flowcode v5 used the exact same Phoneme data in the speech component but did not simulate at all.
And it has a Flowcode 6 example ( Speech 2 )
Speech 2 uses the Real Speak speech engine via the simulation. This sounds much better and you can use sentences rather then breaking words down into phonemes but please note this is simulation only.

If you needed this type of speech for an embedded application then you could record the audio from the simulation as a WAV file and then play the audio back from say an SD card using the FAT component.

User avatar
JLeith
Posts: 537
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 146 times
Been thanked: 26 times
Contact:

Re: LCD not working on my project Hardware

Post by JLeith »

Excellent information Benj

Thank you.

I played around with the sounds and even in the hardware I had a very small spaeker and it was not clear enough.

I have decided to use a Buzzer for 10 msec.

I really appreciate the wisdom of yourself and others.
John

Post Reply