Lost with compile error

For general Flowcode discussion that does not belong in the other sections.
Post Reply
alanwms
Posts: 117
http://meble-kuchenne.info.pl
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 24 times
Been thanked: 7 times

Lost with compile error

Post by alanwms »

IS there a chance you can look at the list of errors and help me figure out what I did wrong?

User avatar
p.erasmus
Valued Contributor
Posts: 434
Joined: Thu Dec 03, 2020 12:01 pm
Location: Russia / Россия
Has thanked: 104 times
Been thanked: 88 times

Re: Lost with compile error

Post by p.erasmus »

Hi ,
It seems all the errors has to do with the UART and string handling functions,
I would first comment the UART and all string macro's out to see what happens
Regards Peter - QME Electronics

medelec35
Matrix Staff
Posts: 1450
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 509 times
Been thanked: 472 times

Re: Lost with compile error

Post by medelec35 »

Hi Alan.
The issue is with

Code: Select all

Closed_loop_PWM2
user macro.
On the yes branch of

Code: Select all

AN1_current_HP > PWM2_Current_Target OR AN1_current_HP = PWM1_Current_Target
the is an undefined Goto Connection point.
I'm guessing it was set for some other connection point e.g B, but that has been deleted?
That would cause this issue.
The no branch also makes the code continue to the end, so the decision branch is redundant.
It can be removed or disabled unless you have just posted a cut down version?
Martin

alanwms
Posts: 117
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 24 times
Been thanked: 7 times

Re: Lost with compile error

Post by alanwms »

You the man! Thanks.

medelec35
Matrix Staff
Posts: 1450
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 509 times
Been thanked: 472 times

Re: Lost with compile error

Post by medelec35 »

For future reference how the error could be found.
1. Make sure you don't have the word error within the project title, so rename.
2. Compile to hex.
3. Either open project Name.msg.txt
or
select Build ribbon, Compiler messages.
Select a blank area within compiler messages text, hold ctrl and press a to select all, then ctrl c to copy (or use the right mouse button)
Run notepad or any text viewer, use ctrl v (or right-click mouse button) and paste within text viewer.
4. Left-click anywhere at the top of the text editor and search (normally ctrl f) for the word error.
In this case, you should see:
Error found.png
Error found.png (4.6 KiB) Viewed 2695 times
That tells you to look for a label (a goto) within FCM (FlowCode user Macro) Closed_loop_PWM2_B
Martin

alanwms
Posts: 117
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 24 times
Been thanked: 7 times

Re: Lost with compile error

Post by alanwms »

Thank you Martin - I did catch the PCC_Closed_loop_pwm2_B, but could not figure out where the "B" came from. I though that was the full name but apparently, it was a goto indicator.
Glad you put this down for me. I was going to ask how I can find this stuff, but felt a little pushy!

I compiled another program with a goto (with nowhere to go to), and went through the steps above - Worked great

Thanks again

BenR
Matrix Staff
Posts: 1733
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 439 times
Been thanked: 602 times

Re: Lost with compile error

Post by BenR »

Regarding this line of code.

Code: Select all

AN1_current_HP > PWM2_Current_Target OR AN1_current_HP = PWM1_Current_Target
This will be doing a binary OR and not a boolean comparison OR which is I beleive is what you are after.

Try this instead.

Code: Select all

(AN1_current_HP > PWM2_Current_Target) || (AN1_current_HP = PWM1_Current_Target)

alanwms
Posts: 117
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 24 times
Been thanked: 7 times

Re: Lost with compile error

Post by alanwms »

Thanks Ben - Not sure of the difference here. Are you pointing out the parentheses? or are you pointing to a difference betweed "or" and "||"

medelec35
Matrix Staff
Posts: 1450
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 509 times
Been thanked: 472 times

Re: Lost with compile error

Post by medelec35 »

Hi Alan.
The parentheses makes sure that calculations or conditions are completed in the correct order.
Using

Code: Select all

||
instead of

Code: Select all

 OR
is vital for the condition to work, so that is the main point.
Martin

alanwms
Posts: 117
Joined: Fri Dec 04, 2020 2:29 pm
Has thanked: 24 times
Been thanked: 7 times

Re: Lost with compile error

Post by alanwms »

Thank you!

Post Reply