RS232 help

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

Moderator: Benj

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

RS232 help

Postby JLeith » Sat Feb 06, 2016 9:39 pm

Hello All
It has been awhile since using RS232. Last was in Flowcode 5 and the RS232 screen is different in Flowcode 6.

I have a old RS232 help but I can't get it to work in Flowcode 6.

Also I'm looking to send two values and have the receiving end display the results. Now I think I need to use two decisision loops to breakdown say "C5".
First read the "C" and then Read the "5"

I have atattched the flow of my new adventure and also the OLD Flowcode.

John
Attachments
RS232 Simple.fcfx
(6.98 KiB) Downloaded 128 times
RS232 Flow.png
RS232 Flow.png (34.42 KiB) Viewed 8092 times

User avatar
acestu
Posts: 1720
Joined: Thu Dec 01, 2011 9:36 pm
Location: Macclesfield UK
Has thanked: 787 times
Been thanked: 226 times
Contact:

Re: RS232 help

Postby acestu » Sat Feb 06, 2016 9:45 pm

Hi John,

I have moved your post to the FC6 section where you will get help quicker.

Thanks
Stuart
These users thanked the author acestu for the post:
medelec35 (Sat Feb 06, 2016 9:48 pm)
Rating: 5.88%
 
Laptop Mac Book Pro i7 retina El Capitan //// Tower/Intel i7-Windows 7 64 Bit, Toshiba i5 Laptop Windows 10
Computers are like air conditioners. They work fine until you start opening windows.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8227
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2352 times
Been thanked: 3338 times
Contact:

Re: RS232 help

Postby medelec35 » Sat Feb 06, 2016 10:01 pm

Hi John,
At the start of your flowchart, Just before the main loop you need to add an RS232 initialise component :
Rs232 Not working1.png
Rs232 Not working1.png (27.12 KiB) Viewed 8078 times


Martin
These users thanked the author medelec35 for the post:
JLeith (Sat Feb 06, 2016 11:48 pm)
Rating: 5.88%
 
Martin

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

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Sat Feb 06, 2016 11:47 pm

Hello Martin

Thank you for the missing spoting the missing "Initalise" for the RS232.

I have it running but can't pin point if I sending digit 5 the LCD says seeing " 0 "

I did a F8 to see what was happening and I see 0 after the post to LCD. it is like it is not reading the RX port C7.

John
Attachments
RS232 Simple1.fcfx
(7.72 KiB) Downloaded 129 times
Zero not 5.jpg
(73.92 KiB) Downloaded 3756 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8227
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2352 times
Been thanked: 3338 times
Contact:

Re: RS232 help

Postby medelec35 » Sat Feb 06, 2016 11:54 pm

Hi John,
JLeith wrote:Thank you for the missing spoting the missing "Initalise" for the RS232.

No problem.
JLeith wrote:it is like it is not reading the RX port C7.

It's not!
Thats because you have if RCV < 255
But no RS232 RX prior to RCV < 255.
Its only after which will be no good.
Therefore the yes branch will never be accessed.
You either need RS232 RX prior to if RCV < 255
or use RS232 interrupt which would be better in my opinion.

Martin
These users thanked the author medelec35 for the post:
JLeith (Sun Feb 07, 2016 12:06 am)
Rating: 5.88%
 
Martin

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

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Sun Feb 07, 2016 12:09 am

Hi Martin

Mystery is still odd.

I took out the "If RCV < 255"

Still getting the '0"

Can you explain the RS232 Interrupt ? I was looking thru the help files and I don't see a video on the subject.

John
Attachments
RS232 Simple2.fcfx
Simple 2 flow
(7.41 KiB) Downloaded 124 times
No YES No.png
No YES No.png (27.64 KiB) Viewed 8059 times

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Sun Feb 07, 2016 12:43 am

I went back and study the examples and this time I tried the "Console" Data entry.

The RS232 Data says Received value but it won't dipslay on the LCD.

John
Attachments
Console.jpg
Console.jpg (72.97 KiB) Viewed 8054 times

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8227
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2352 times
Been thanked: 3338 times
Contact:

Re: RS232 help

Postby medelec35 » Sun Feb 07, 2016 12:47 am

Hi John,
A couple of different ways.
1a = without RX interrupt.
1b = with RX interrupt. (RXint call macro is for simulation only. It must be disabled before compiling to chip).

Martin
Attachments
RS232 Simple1b.fcfx
(8.09 KiB) Downloaded 166 times
RS232 Simple1a.fcfx
(7.75 KiB) Downloaded 154 times
These users thanked the author medelec35 for the post:
JLeith (Sun Feb 07, 2016 12:56 am)
Rating: 5.88%
 
Martin

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

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Sun Feb 07, 2016 1:00 am

My eyes must be out of sync.

I ran both 1A amd 1B and I don't get a LCD reading.

Do you get a reading

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8227
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2352 times
Been thanked: 3338 times
Contact:

Re: RS232 help

Postby medelec35 » Sun Feb 07, 2016 1:08 am

Yes works fine for me. Have you manually added numbers to the RX queue within the console?
These users thanked the author medelec35 for the post:
JLeith (Sun Feb 07, 2016 8:44 pm)
Rating: 5.88%
 
Martin

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

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Sun Feb 07, 2016 8:53 pm

My Errow
I missed the Console.

Yes now it is displaying nicely.

The 1A version workes more like I envisioned. Thank you.

You know the biggest item that I never found in all the information with Flowcode video's.

Using the "Calculatiuons" to receive the ASCII RS232 ( Decimal value) - 48 to get the value that was sent.

Now I just need to do some caluculation routes to detect "HC5" and place it into a variable to us to display the corrrct QUAD 7 Segment.

H = Quad 1 + 2
C = Quad 2
5 = the value to place on Quad 2.

I will play with the 1A and see how it works out. More knowledge for my mind and paper documents to use in the future.

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8227
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2352 times
Been thanked: 3338 times
Contact:

Re: RS232 help

Postby medelec35 » Sun Feb 07, 2016 11:12 pm

Hi John,
JLeith wrote:Now I just need to do some caluculation routes to detect "HC5" and place it into a variable to us to display the corrrct QUAD 7 Segment.

H = Quad 1 + 2
C = Quad 2
5 = the value to place on Quad 2.

I can point you in the right direction with a flowchart.

Are you using the internal or external osc.
If external what value is crystal or resonator?

Martin
These users thanked the author medelec35 for the post:
JLeith (Mon Feb 08, 2016 7:44 pm)
Rating: 5.88%
 
Martin

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

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Mon Feb 08, 2016 8:01 pm

Thank you Martin for the help.
This is the knowledge I have developed with RS232 and testing

Internal OSC has worked in the past.

I have tested using the ( 1A version ) it looks like only 2 characters can be received ?

I was planning on using code numbers with the value if that makes sense
I need the follwing from ( Pitch Count Master ) to Team Display Feb 8

Pitch Count Master
H = Home Count
I = Home Tens
J = V_Count
K = V_Tens
L = Reset Home display
M = Reset Visitor

From the Pitch Count Master I beleive the results to transmit can be sent from macro ( timer_int ) the values can be selected as they are displayed for the QUAD 7 segment

Example
H3 TX --------RCV runs Home Count and display in the QUAD 2 digit 3.

I have included the ( Pitcher Count Master ) and the ( Team Display Feb 8th in progress )

In the Team display I was using lower case ( h ) and now I can see capital ( H ) and others is workable.

I hope this works.
Attachments
Team Display Feb 8 RS232.fcfx
(25.5 KiB) Downloaded 129 times
Pitcher count Master.fcfx
(84.25 KiB) Downloaded 120 times

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Tue Feb 09, 2016 2:31 am

Hi Martin
I beleive I have a working Team Display.

I was able to get the flow to display on the QUAD 7 segment.

If you have a moment can you look over my flow and see if it can be done a cleaner flow.

I might add a buzzer on the Team display but I think I should use a relay I don't know if I can drive a Buzzer directly.

Martin I see there is a "Speech" Output. Have you worked with it ? Maybe I could use a speaker on the Team Display and when the Pitcher reaches 25 I could have a audio sent by RS232 from the Pitcher control ?

Martin have you done anything with WireLess ? My tx range would be 70 feet (21 Meters). Could I interface via wireless ( PITCHER ------- Team )

I currently will be RS232 with 4 wire connections 21 meters.

John

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Tue Feb 09, 2016 3:36 am

Hi Martin

I thought I would try the 'Speech" Output.

Here is my steps.
1. Added the Output display
2. Access the help files to figure out.
3. Downloaded Speech 2.
4. Add a quick Speech Macro to Team Display ( S )
5. Added the Macro options to Main
6. Simulated ---- No sound ????
7. Went to the Speech 2 flowcode and copied the "Speech"
8. Placed the Speech into my program.
9. **** The Speech worked ****
10. My original Speech would not work.

At a loss. The Help Sample 'Call Macro" is not from Flowcode 5 I tried.

The options in the Sample Macro don't match the options from Flowcode 6.
Attachments
Team Display Feb 8 Speech RS232.fcfx
The Flowcode is Speech action
(29.46 KiB) Downloaded 127 times
Speech Macro.jpg
Speech Macro.jpg (58.42 KiB) Viewed 7974 times

User avatar
Benj
Matrix Staff
Posts: 13948
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4224 times
Been thanked: 3980 times
Contact:

Re: RS232 help

Postby Benj » Tue Feb 09, 2016 11:08 am

Hello,

The speech component has two working modes.

1) The Speak function allows you to output text strings as voice using the RealSpeak library. This is useful for simulation e.g. when using the Flowcode simulation linked to some real world hardware. This has the frilly simulation icon to show it is sim only.

2) The OutputPhoneme function allows you to output a Phoneme or string of Phonemes. e.g. "OY" or "OY,AY,OY". If you look at the properties of the Speech component you will see which Phonemes are present in your program. To say a sentence like "Pitcher at 25 Pitches" you need to break up the words into their phonemes and then output the phonemes, unfortunately there is no automatic way of doing this. "Pitcher" might look something like this as Phonemes. "PP,IH,TT1,CH,ER1,RR1". This speech type should work in both the sim and on the embedded device.

If you need good sounding speech strings then a better way might be to record the audio yourself as a wav file, store the file onto an SD card and then on the embedded device stream the audio from the SD card. This is how things like musical birthday cards and children's story books work, though maybe without the SD card :D .

There are examples of both speech types here: http://www.matrixtsl.com/wiki/index.php ... de5f9b41a8

Hope this helps.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8227
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2352 times
Been thanked: 3338 times
Contact:

Re: RS232 help

Postby medelec35 » Tue Feb 09, 2016 10:22 pm

I have looked into speech a bit and it fails to compile with 16F1937 as it does not have a Program memory table like the PIC 18F series.

No I have never used the speech component yet.

Martin
Martin

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

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Tue Feb 09, 2016 10:29 pm

Hi Martin
Which 18F would work.
Very odd when I paste the Speech from the help file I get the speech 100% when I run the flowcode.

So you are saying that there will be no audio be presented to PORT C2 ?

John

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8227
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2352 times
Been thanked: 3338 times
Contact:

Re: RS232 help

Postby medelec35 » Tue Feb 09, 2016 10:36 pm

JLeith wrote:Very odd when I paste the Speech from the help file I get the speech 100% when I run the flowcode.

So you have compiled flowchart and it compiles 100% successfully?
Martin

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

User avatar
JLeith
Posts: 489
Joined: Wed Nov 14, 2012 7:49 pm
Location: British Columbia Canada
Has thanked: 130 times
Been thanked: 22 times
Contact:

Re: RS232 help

Postby JLeith » Wed Feb 10, 2016 3:19 am

No I have not had a chance to compile.

Hopefully tomorrow ( Wed )

I will let you know the status. I ran out of Bread Boards.

John