Jump from a Macro to Main

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

Moderators: Benj, Mods

Post Reply
janleroux
Flowcode V4 User
Posts: 12
Joined: Sun Mar 11, 2007 6:02 pm
Location: South Africa
Contact:

Jump from a Macro to Main

Post by janleroux »

Hi

According to the help file: "To jump to a connection point called A, defined in a Flowcode macro called TEST, you C code must be goto FCC_TEST_A;. Connection points defined in the main flowchart of a Flowcode file are prefixed FCC_Main_."

If I try it, then I get the following error:
error: undefined label 'FCC_Main_C'
This is what I have done:
I have created a connection point called "C" right in the beginning of my "Main". From a macro I am using the following code in a C Code box:

Code: Select all

goto FCC_Main_C;


I had a look through the forums, but I could not find any similar examples. Is there some additional code that is not mentioned by the help file that is required, or is this a bug?

Thanks for your help!

Best Regards
Jan

User avatar
Steve
Matrix Staff
Posts: 3426
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

It is not a good idea to jump between macros in this way - you should organise your program in a different way.

Flowcode "macros" are subroutines. If you jump between subroutines, then the PICmicro's internal return address stack will become corrupted and your program will start behaving strangely.

janleroux
Flowcode V4 User
Posts: 12
Joined: Sun Mar 11, 2007 6:02 pm
Location: South Africa
Contact:

Post by janleroux »

Hi Steve,

I understand, but the jump that want to make is to take me right to the beginning of my main routine - everything will be re-initialized etc.

Is there another way to perform a software reset?

Regards
Jan

User avatar
Steve
Matrix Staff
Posts: 3426
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

If you are using an 18F series PICmicro, you can use the ASM command "reset" - this will perform a soft reset.

Alternatively, you should do something similar to the following in a 'C' icon:

Code: Select all

_asm 
{
  clrf    _intcon
  clrf    _status
  clrf    _pclath
  clrf    _pcl
} 

Post Reply