Flowcode and Reality not matching

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

Moderator: Benj

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:

Flowcode and Reality not matching

Post by JLeith »

Hello members,

I have looked at this every way possible and can't see why it is not working.

I run the simulation in Flowcode and it works as I expect.

I load it into the PIC and it doesn't work correctly.

The "OUT" is the the only one I can't clear and set to code 51.

I have taken my Servo control program and modified it to display all the actions on a 4x20 LCD.

Ball - Strike and Inning clear just "Out" won't on the PIC.

In flowcode it follows correctly,
Here is the RS232 values
Ball - A
Strike B
Out - C
Inning - F

So when I send C1 the PIC displays Out -1
Then I send Cc and this is the Clear Display ( Ok In Flowcode ) ( Nothing happens on LCD )

John
Attachments
Score Board Summary Display 1 4x20 Oct 8.fcfx
This is the Flowcode program
(60.17 KiB) Downloaded 242 times
This is from Flowcode
This is from Flowcode
4x20 from Flowcode.jpg (18.71 KiB) Viewed 10212 times
This is the image from the PIC
This is the image from the PIC
4x20 display.jpg (39.61 KiB) Viewed 10212 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: Flowcode and Reality not matching

Post by medelec35 »

Hi John,
They match for me:
LCD Score Board1.jpg
LCD Score Board1.jpg (26.52 KiB) Viewed 10198 times
I have several suggestions with your Flowchart.
1) The RX interrupt calls a macro with in turn calls another macro that contains LCD components.
Both of these are not good practice although hardware works for me.
For good practice don't allow an interrupt macro to be exited before the end.
Only let it end naturally at the bottom only.
If you use components with delays or other common functions in then if the component is used in interrupt as well as any other call macro then corruption is more than like to occur.

Since you have an LCD you may as well use it more for a diagnostic tool until you get flowchart working the way you want it to.
You're using 51 which is good, but why don't you get it to display every RXData value detected.
Then you can see why it may not be working for you.

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: Flowcode and Reality not matching

Post by JLeith »

Very Strange.

I will retest and see what can be happening.

Thank you I will look at the program more closely. It was just something I was trying as a diagnostic is for some reason the display stopped working.

I just took the endless project you and I and mostly your master skills. Taking the Servo action pic16F1937 program and selecting all the codes and displaying them on the 4x20.

I have to do some clean up like remove the Servo action seeing this is only a tool to ensure the codes continue to work.

I just received a new wireless receiver and wiring it up. Do you think this will work. I tried to simplify my wiring and had the 1.2K DIP pack resistors.

The old circuit had the ground bias at 390 ohm.

Off to retest.

John
Attachments
INPUT.jpg
INPUT.jpg (21.82 KiB) Viewed 10189 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: Flowcode and Reality not matching

Post by medelec35 »

Hi John there is not a reason I can see for it not to work.
for a pull-down resistor I usually say 2k2 to 4k7 but 2x 1K2 will be fine.
Maximum current though resistor will be 5/1k2 = 4.2 mA

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: Flowcode and Reality not matching

Post by JLeith »

Well I just received a brand new Transmitter and a new Receiver Board.

The manufacture upgraded there Transmitters and Receiver Boards.

I just finished rewiring them.

Well the monster is back. No 51 for the OUT.

I will do some testing and see why yours works and not mine.

John

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: Flowcode and Reality not matching

Post by medelec35 »

If it was was me, I would set the 51 in the same position as the 1 i.e for the top line use cursor x=5, Y=0
Then as i stated in my earlier post, Print received RX values. perhaps both on separate lines.
Don't forget to add PrintString" " after the number appearing after

Code: Select all

:

Otherwise if Ball is = 51 due to clear being sent, then if Ball = 1
display will show:
Ball:11
instead of
Ball:1

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: Flowcode and Reality not matching

Post by JLeith »

Thank you martin
What I did is at the beginning of the "Tree" say for ball. I sent a Clear line and then printed "Ball" again. So the 51 was displayed and then when Ball 1 was send it cleared the Line and presented Ball 1.

I have been looking and looking for why OUT works for you but not in my case.

It might be that my PIC 16F1927 is not sending the Cc to clear the Outs.

I have the servo driver for the OUT segment and I going to see if also does not recognize the Cc clear.

I will post the results.

All the best
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: Flowcode and Reality not matching

Post by JLeith »

The court has a verdict

The Summary Display has a flaw

Here is the Summary Master and the Servo Out.

Summary still has Out 1 and the Servo has 'Clear "
Attachments
Master vs Servo Out.jpg
Master vs Servo Out.jpg (148.1 KiB) Viewed 10065 times

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: Flowcode and Reality not matching

Post by JLeith »

Mystery - No logical reason

I add the RXData and on my start up.

Sending ( A0 - Ball = 0 ) ( B0 - Strike =0 ) ( C0 - Out =0 )

Now I have the Out Servo display running in parallel with the summary display

Here is what I get
Summary -- Ball = 0 RXData = 88 not sure why but it works
-- Strike - 0 RXData = 66 - Good
-- Out ----Nothing
OUT Servo ---- Out = 0

Now if I send OUT = 1 ( Summary Out=1 RXData = 67 ) OUT Servo ( Out = 1 )

How is it that the first display ( 0 ) is not showing up on Summary 4x20 but on Servo

Then when I send Out = 1 the Summary works.

The RS232 is feed to the Servo and Summary at the same time. Only difference is 6mm of wire.
Attachments
Scratch.jpg
Scratch.jpg (8.36 KiB) Viewed 10055 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: Flowcode and Reality not matching

Post by medelec35 »

Hi John,
I have modified your Flowchart to the way I suggested LCD is used as a diagnostic tool.
The values represent ASCII data received:
Diagnostic.png
(20.43 KiB) Downloaded 6255 times
In this case ASCII 66 = B
For the second command you will need to - 48.
E.g 50 - 48 = 2
For Cc you should see:
Diagnostic Cc.png
(20.46 KiB) Downloaded 6255 times
The issue will be with the transmission of RS232 Since I use Hyperterminal to send Cc therefore receiver PCB must be ok.

Martin
Attachments
Score Board Summary Display 1 4x20 Oct16.fcfx
(62.54 KiB) Downloaded 247 times
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: Flowcode and Reality not matching

Post by JLeith »

Thank you Martin

Running the Flowcode the 'Out " vanishes

This is the sequence I was sending ( A1B2C3F5A2B3C4F7AcBcC2F1CcA1 )

I will do some more testing

John

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: Flowcode and Reality not matching

Post by medelec35 »

Hi John,
Sorry posted wrong version I should have posted the version with a in.
Attachments
Score Board Summary Display 1a 4x20 Oct16.fcfx
(62.16 KiB) Downloaded 208 times
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: Flowcode and Reality not matching

Post by JLeith »

99 %
Hi Martin
Not a problem I have your latest and the Outs don't crash

1 item the Ball, Strike, Out values don't show I see the ASCII

Like Ball: 2

i will see if I can't see it.

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: Flowcode and Reality not matching

Post by JLeith »

Hi Again Martin
I might have noticed something.

On start up the Main PIC sends out A0,B0,C0 as a confirmation of ready to go.

When I load the PIC with Version 1 Oct 16.

The display only shows A0. Now I have the Servo box for Outs and it see the C0.

Might it be that the Summary PIC program is not running fast enough to see the sequence A0 ---- 500ms B0 ------500ms ------- C0 ----250ms

This is suspect is not a issue with the Servo receivers because they are only responding to 1 display.

Where in the Summary it is seeing all 3 with 500ms spread. The Summary would have to cycle in say 25msec to capture all events

When the Clear segment is sent out in 50msec

Not sure how to Capture how long it takes Summary to collect the RS232 and get back to see the next event.

Maybe on your Data Scope program. Can you sequence the A0 B0 C0) going out on the Hyperterminal with 250 msec separation.

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: Flowcode and Reality not matching

Post by JLeith »

When it is only the Out sequence it works just gets confused when the info on the RS232 is coming so fast.

John

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: Flowcode and Reality not matching

Post by medelec35 »

Hi John,
I have modified flowchart for better simulation.
Should work faster.

Martin
Attachments
Score Board Summary Display 1 4x20 Oct17 .fcfx
(63.44 KiB) Downloaded 184 times
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: Flowcode and Reality not matching

Post by JLeith »

Hi Martin

The Ball 1 appears and the 65 / 49 works

Then the Ac ( Clear Ball Display ) 65 / 99 but the Ball: 1 is still displayed.

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: Flowcode and Reality not matching

Post by JLeith »

Also I was just looking and there is really no need for the Servo tree seeing all this Summary is to collect the RS232 actions.

Your thoughts

John

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: Flowcode and Reality not matching

Post by medelec35 »

If there are never going to be servos connected, then all the servo routines could slow things down.
Since RS232 interrupt is use that should not affect data.
I have just been modifying the chart that you added Tree call macro and LCD macros to.
To be honest if it was me I would not do it that way because the Tree and LCD macros are called within RX interrupt service routine as explained in a previous post.
Corruption will most probably occur
When you compile flowchart, take a look and any stack corruption warnings just after: Building CASM file.
If you see any then there are potential problem's when running hardware.

Anyway I moved a couple of component macros for testing purpose, and just did not move them back prior to posting
The attached file should show 51 when clear now.

Martin
Attachments
Score Board Summary Display 1a 4x20 Oct17 .fcfx
(63.39 KiB) Downloaded 171 times
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: Flowcode and Reality not matching

Post by JLeith »

Martin you are a Master Wizard.

The Flowcode model works perfect.

On the PIC not 100% that is the oddest part.

Here is my test
On start up - Ball = 0 Strike= 0 Out = 0
Ball = 1 Strike = 2 Out =0
Did the clear Ball & Strike Ac Bc only Ball = 0 Strike = 0 Out stays at 0 ----- Perfect

Ball = 1 Strike = 1 Out = 1
Clear Board ---- Ball = 51 Strike = 51 Out = 1 ------ X

Here is the picture - The pond Ghost is back

Off to see my grandson play Soccer.

John
Attachments
Oct17.jpg
Oct17.jpg (104.46 KiB) Viewed 9942 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: Flowcode and Reality not matching

Post by medelec35 »

Hi John,
Your 4 line display is showing 66 & 99
66 = B & not C
Therefore the PCB with 4line display has only received the command to clear line B.
I would assume the 2 line display is part the RS232 sending side.

So perhaps that is a problem with generation of Cc RS232 data?
Can you send the flowchart that's sends RS232 for Cc
I can then take a look to see if Cc is being sent correctly.

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: Flowcode and Reality not matching

Post by JLeith »

The 2 line is the Servo PIC action.

I was using that to track the Ghost for the OUT status.

That is why I placed it in the picture to indicate the Cc was sent.

Yes I have attached the main control pic 16F1827

It sure is a mystery

John
Attachments
Flowcode Scoreboard Sept 15 V6_v6.fcfx
(102.75 KiB) Downloaded 172 times

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: Flowcode and Reality not matching

Post by JLeith »

Martin if you have a moment maybe you can capture all the A1 B1 C1 D1 E1 F1 G1 H1 and then the Ac Bc ...... Hc

On the USBEE scope so we have a record I can add to my binders of knowledge.

John

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: Flowcode and Reality not matching

Post by medelec35 »

Hi John,
JLeith wrote:Martin if you have a moment maybe you can capture all the A1 B1 C1 D1 E1 F1 G1 H1 and then the Ac Bc ...... HcOn the USBEE scope so we have a record I can add to my binders of knowledge.
Sorry, not got hardware set up to do that.
Can you try the attached flowchart and see if it clears the board ok?
Attachments
Flowcode Scoreboard Oct 17 V6_v6.fcfx
(105.92 KiB) Downloaded 174 times
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: Flowcode and Reality not matching

Post by JLeith »

Hi Martin

Great news .... it worked.

For my knowledge what did you change. I usually post a memo on the top of Main.

John
Attachments
Horray.jpg
Horray.jpg (11.25 KiB) Viewed 9931 times

Post Reply