Page 1 of 1

Bug: round function causes compile error.

Posted: Sat Mar 28, 2020 1:51 pm
by AbhijitR
Hello! Martin

Following the post regarding rounding a real number, everything worked well on the 19th of March, I mean compilation and running on the hardware, after that day I was not able to work on the project due to crises, today when I opened the project I received the popup for updates, as usual I did the complete update and restart FC.

Now I am receiving an error report when I compile (the same chart without any changes) and the error points out to

19477: FCV_DIFF_PRES_VAL_CAL_REAL = {(long)(if (FCV_DIFF_PRES_VAL_CAL_REAL >= 0.0)(FCV_DIFF_PRES_VAL_CAL_REAL) + 0.5; else (FCV_DIFF_PRES_VAL_CAL_REAL) - 0.5)};

If I have not mistaken this is regarding the rounding function, after I disabled all the rounding functions at all the four different locations and compiled with success. Is this something to do with todays update? can you suggest where it is going wrong? can I uninstall todays updates and validate? so many doubts....

Thank you.

Regards
Abhi

Re: Division by 10 easy?

Posted: Sat Mar 28, 2020 3:11 pm
by medelec35
I have updated my version to the latest.
Can you post the flowchart, so I can see if it compiles for me or not?

Re: Division by 10 easy?

Posted: Sat Mar 28, 2020 3:27 pm
by AbhijitR
Hi!

Thanks for the reply, I have attached a part of the FC, the calculation block in the beginning of the loop if you disable the round off line it compile well on my machine.

Hear you soon.

Abhi

Re: Division by 10 easy?

Posted: Sat Mar 28, 2020 11:30 pm
by medelec35
It does look like there is an issue with the

Code: Select all

round
function
What about replacing the

Code: Select all

round
with

Code: Select all

ceil
?
So you have

Code: Select all

Diff_Pres_Val_Cal_Real = ceil (Diff_Pres_Val_Cal_Real)

Re: Division by 10 easy?

Posted: Sun Mar 29, 2020 6:40 am
by AbhijitR
Hello! Martin
good morning
medelec35 wrote: with

Code: Select all

ceil
?
You are a genius, I don't know the trick but the term/word "ceil" did it, now the chart compile with success.

Thank you again, do take care, stay safe.

Regards
Abhi

Re: Division by 10 easy?

Posted: Sun Mar 29, 2020 10:56 am
by medelec35
You're welcome.
Even though project now compiles, are you getting required results with your hardware?

Re: Division by 10 easy?

Posted: Sun Mar 29, 2020 5:26 pm
by AbhijitR
Hi!
medelec35 wrote: Even though project now compiles, are you getting required results with your hardware?
Yes you are again right Martin, no doubt the chart compile but the function is not rounding the figures as it should, what can be done? any idea.

Thank you.

Abhi

Re: Division by 10 easy?

Posted: Sun Mar 29, 2020 6:06 pm
by medelec35
Until the bug is fixed.
Can you try the attache flowchart on your hardware?
I have split the topic and moved to the bugs section.

Re: Bug: round function causes compile error.

Posted: Mon Mar 30, 2020 8:32 am
by AbhijitR
Hello! Martin

Thanks for taking the correct action.

I tried to run the chart which you last posted, it opened but with one warning about created in new version, so I uninstalled the old version and download the version 8.2 (the big download button) and installed, I also tried to install the patch file and hotfix but received one more error from windows installer so I let it for the moment.

Now I am able to open the recent chart which you posted but unfortunately it do not round off for e.g. 38.25 to 38 but it will round off to 39

I hope someone from Matrix team will also check about the round off function not working or may be I am doing some mistake.

Thank you very much again, hear you soon.

Abhi

Re: Bug: round function causes compile error.

Posted: Mon Mar 30, 2020 11:45 am
by LeighM
Hi Abhi,
Please try the attached to go into
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC

Re: Bug: round function causes compile error.

Posted: Mon Mar 30, 2020 1:16 pm
by AbhijitR
Hi! Leigh

Thank you to address this problem quickly, as per your instructions I deleted the existing *.c file and paste the one you posted, restart FC, compile successfully and run on the hardware too now the rounding function works like before, I will take some more trials and keep you posted but I am sure it works like before.

Thank you to Martin too for creating the new post.

Take care, stay safe.

Abhi

Re: Bug: round function causes compile error.

Posted: Tue Mar 31, 2020 6:37 am
by AbhijitR
Hello! Leigh
good morning

Following your last post regarding replacing the PIC_CAL_Float.c notepad file from the C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC location with the notepad file which you provided in that post, everything works well i.e. simulation, compilation and also hardware.

But once I open the same chart again fresh, I am prompted to install the new updates, after completing the update process, same compilation error occurs again. I again followed the same process of deleting and replacing, everything works well.

I tried to compare both the notepad files, the one you gave and the one which I receive after update, there is some difference, I have attached the comparison for your reference, the one highlighted in red is your notepad file and the one in green is from the update. To be honest I do not understand what is the difference (not my cup of tea), :(

Today morning I was again prompted to update but I have skipped the same for the moment, I will do that once the file in update is corrected.

Thank you, hear you soon.

Abhi

Re: Bug: round function causes compile error.

Posted: Tue Mar 31, 2020 8:37 am
by LeighM
I have skipped the same for the moment, I will do that once the file in update is corrected.
Yes, please wait until the new corrected version is available in the update system,
this might take some time as we have limited access to the office at the moment.
Thanks!
Leigh

Re: Bug: round function causes compile error.

Posted: Mon Nov 30, 2020 12:56 pm
by Brendan
Hi Team.

Just advising that the compile bug with the FP rounding function still exists.

Many thanks,
Brendan

Re: Bug: round function causes compile error.

Posted: Mon Nov 30, 2020 1:12 pm
by LeighM
Looks like the updated PIC CAL file is now in the update system OK.
Can you check you are up to date?
If you still have an error could you please post a sample program demonstrating the issue that you have?
Thanks

Re: Bug: round function causes compile error.

Posted: Mon Nov 30, 2020 2:00 pm
by Brendan
Thanks Leigh.

Coding for the PIC32MZ, I created the following FP vars:

.TempFP
_Deg_C_Top_Float

and a compile error results should I use the following in a calculation:

.TempFP = fround (_Deg_C_Top_Float,2)

Commenting out the above and creating a workaround then builds without issue.

My first thoughts were to check for updates (which I applied this morning for the full database), but still no joy.

Quick example project:
Flowcode_Float2Int_Issue.fcfx
(6.59 KiB) Downloaded 131 times

Best regards,
Brendan

Re: Bug: round function causes compile error.

Posted: Mon Nov 30, 2020 2:33 pm
by LeighM
Thanks for the spot.
Please try the attached, to go into ...
C:\ProgramData\MatrixTSL\FlowcodeV8\CAL\PIC32BIT

Re: Bug: round function causes compile error.

Posted: Mon Nov 30, 2020 3:01 pm
by Brendan
Thank you Liam for your support and early reply.

That worked 😁👍

Best regards,
Brendan