C Code conversion to Icon

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

Moderator: Benj

Post Reply
User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

C Code conversion to Icon

Post by QMESAR »

Hi Team.

Please help me out in understanding the C code conversion engine at present

It seems that only C code that is listed in the FC8 function table can be converted to an Icon /simulated.
C ode that contains general C and access directly to mcu registers can not be converted
or am I understanding this concept wrong. below a block of C code that I am using but it cannot or will not convert to a FC Icon

This in a C code Icon converts to a FC Icon
P1.jpg
P1.jpg (236.88 KiB) Viewed 3183 times
This does not convert
P2.jpg
P2.jpg (90.08 KiB) Viewed 3183 times
Thanks for the help as always :D

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

Re: C Code conversion to Icon

Post by Steve »

The C-code conversion does not understand the dot notation (things like T1CONbits.TON) which is why it is failing.

If you first replace the "." with "_" in those 3 lines of C code, then it should partially convert. You will be left with C code statements like "T1CONbits_ON = 0;" which you can change the "_" back to "."

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: C Code conversion to Icon

Post by QMESAR »

Hello Steve.
Thank you for your reply.
I have made a simple project and I tried our T1CONbits.TON as you mentioned it seems I am doing something wrong as
flowcode does not understand it ,sorry for my stupidity
P1.jpg
P1.jpg (79.7 KiB) Viewed 3167 times

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

Re: C Code conversion to Icon

Post by Steve »

You're not being stupid! There is something a bit strange going on with the way it tries to convert variables it doesn't know about. Also, the workaround I suggested does not fix it, but does allow Flowcode to try to convert what it can (i.e. known variables and C constructs).

Have a look at this project:
C_conversion.fcfx
(6.94 KiB) Downloaded 170 times
If you try to convert each C code icon, you'll see the 2nd and 3rd ones seem not to work. But these have just a single line of C code preceded by C comments, so the conversion keeps these together. All the other C icons do convert what they can, but leave the problem lines (e.g. T1CONbits_TON = 0;) as separate C code icons.

Does this help?

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: C Code conversion to Icon

Post by QMESAR »

Hi Steve,
Thank so much yes it is clear what is happening and it not an big issue or game changer at the moment by uing a mix of the abilities i will get some realistic flowchart

It would be perfect if the converter could converts the bit field(dot notations) and the registers but I guess that is a wish far off

I am happy we saw what is happening :D

Regards

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

Re: C Code conversion to Icon

Post by Steve »

QMESAR wrote:It would be perfect if the converter could converts the bit field(dot notations) and the registers but I guess that is a wish far off
We're looking into it. If it's fairly easy to add, we should be able to get it in to our next release.

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1287
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 384 times
Been thanked: 614 times
Contact:

Re: C Code conversion to Icon

Post by QMESAR »

Hi Steve,
Wow that would be great ,
Thank you very much for your support today :D

Post Reply