Goto connection Point

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

Moderator: Benj

User avatar
jollybv
Flowcode v5 User
Posts: 342
Joined: Thu Feb 12, 2009 5:20 am
Has thanked: 77 times
Been thanked: 24 times
Contact:

Goto connection Point

Postby jollybv » Fri Mar 13, 2015 1:50 pm

Hi Guys

Not sure what is going wrong with my program but i sit in a macro called Menu and scroll down to the various options go do what is needed and then when done scroll to the last option in the menu which is exit i then press the enter key (11) to exit which goes into a decision Key = 11 and then has a go to connection point which jumps out the loop and ends the macro. What happens is say i have 10 menu items and i execute for example item 4 and after executing the instructions i scroll down last item in the menu which is exit menu then press enter it goes back to item 4 i then need to scroll down again to exit and pres enter again and it exits. It seems to totally ignore the go to connection point on the first pass. If i step through it on the PC it seems to work correctly but when i load it to the chip dose not work I cant really test in PC cause i have interrupts running any ideas on how to solve this problem??

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Goto connection Point

Postby hyperion007 » Fri Mar 13, 2015 2:02 pm

Hi,

Please post your program if you can. It is very difficult to troubleshoot without it. It may be a stack overflow problem?

User avatar
jollybv
Flowcode v5 User
Posts: 342
Joined: Thu Feb 12, 2009 5:20 am
Has thanked: 77 times
Been thanked: 24 times
Contact:

Re: Goto connection Point

Postby jollybv » Fri Mar 13, 2015 2:07 pm

Hi

Thanks for the reply it is a very large program i will send it in a PM if you would like

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Goto connection Point

Postby hyperion007 » Fri Mar 13, 2015 2:08 pm

Sure. Send it and I'll have a look.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Goto connection Point

Postby hyperion007 » Fri Mar 13, 2015 3:43 pm

I've gone through some of your program now and I can tell you why you are having problems with this.

I did similar things when I started programming with Flowcode.

Let us start from the Main macro. You should try to write the program so that it spends as much time as possible inside this macro.
You have created macros that contain nothing but delays which there is no reason for and should not be done.
The same goes for your macros that only contain one component macro. There is no reason for that, why not just put the component macro directly where you need it?

Also, try to write your programs so that all macros are called from the Main macro and not from one macro to another macro then another macro and so on. This will cause a stack overflow situation.
Think about what happens if your program is currently waiting in a macro many steps removed from the Main macro and an interrupt occurs that needs to be processed.

You should take notice of the warnings you get when you compile your program.

These should have told you where to start:


Warning: Recursion may cause call stack overflow in function:'FCM_Collect_Unit_No'
Warning: Recursion may cause call stack overflow in function:'FCM_Start'
Warning: Recursion may cause call stack overflow in function:'FCM_PIN'
Caution: argument of 'delay_us' calls must have a value of 1 or more
Caution: Delay inaccurrate: 'delay_us', Delay overhead:0ms, Unit delay:0.00101725ms, Delay resolution:1 units
Caution: Delay inaccurrate: 'delay_ms', Delay overhead:0ms, Unit delay:1.00016ms, Delay resolution:1 units

Serious Warning: Possible sw stack corruption, function 'FCM_Getkey' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)

Heap size:1670 bytes, Heap max single alloc:127 bytes

User avatar
jollybv
Flowcode v5 User
Posts: 342
Joined: Thu Feb 12, 2009 5:20 am
Has thanked: 77 times
Been thanked: 24 times
Contact:

Re: Goto connection Point

Postby jollybv » Fri Mar 13, 2015 4:06 pm

Hi

Thanks so what you telling me is that I must redo this program oh hell it taken a long time to get it here but i will see how i can change it not sure where to start.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: Goto connection Point

Postby hyperion007 » Fri Mar 13, 2015 4:34 pm

Well start with the easy things like delays and other macros with just one function/macro inside. Then go on from there. Test each change etc.