Page 1 of 1

C Code Declarations

Posted: Tue Jul 06, 2021 10:23 am
by jay_dee
Hi,
I am using some old code from V8 FC and ECIO40, moving a project to V9 and the dsPIC ECIO40P16.

IC code blocks, do I need to declare any new variable at the start of each code block?
Could I declare/initiialise these variables at the start of the flowcode in thier own code block?
thanks, J.

Re: C Code Declarations

Posted: Tue Jul 06, 2021 11:03 am
by Steve-Matrix
If your variables are only needed within the C code block itself, then declaring them there should be ok.

However, if you want to access the same variable in different places within your program, then you can declare them in the defines section of the "supplementary code" feature. This is in the "Build..Project options" screen.

To initialise them, you will probably want to do this in a C code icon at the start of your "main" flowchart.