C Code conversion to Icon

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

Moderator: Benj

User avatar
QMESAR
Valued Contributor
Valued Contributor
Posts: 1182
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 376 times
Been thanked: 600 times
Contact:

C Code conversion to Icon

Postby QMESAR » Wed Jul 17, 2019 8:29 am

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.89 KiB) Viewed 903 times


This does not convert
P2.jpg
P2.jpg (90.08 KiB) Viewed 903 times


Thanks for the help as always :D

User avatar
Steve
Matrix Staff
Posts: 3088
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 391 times
Contact:

Re: C Code conversion to Icon

Postby Steve » Wed Jul 17, 2019 9:12 am

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: 1182
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 376 times
Been thanked: 600 times
Contact:

Re: C Code conversion to Icon

Postby QMESAR » Wed Jul 17, 2019 10:33 am

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 887 times

User avatar
Steve
Matrix Staff
Posts: 3088
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 391 times
Contact:

Re: C Code conversion to Icon

Postby Steve » Wed Jul 17, 2019 10:53 am

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.95 KiB) Downloaded 33 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: 1182
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 376 times
Been thanked: 600 times
Contact:

Re: C Code conversion to Icon

Postby QMESAR » Wed Jul 17, 2019 11:08 am

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: 3088
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 89 times
Been thanked: 391 times
Contact:

Re: C Code conversion to Icon

Postby Steve » Wed Jul 17, 2019 11:53 am

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: 1182
Joined: Sun Oct 05, 2014 3:20 pm
Location: Russia
Has thanked: 376 times
Been thanked: 600 times
Contact:

Re: C Code conversion to Icon

Postby QMESAR » Wed Jul 17, 2019 1:16 pm

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