Questions FCI_SCOPY ... String Variable in C Code Icon

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Questions FCI_SCOPY ... String Variable in C Code Icon

Post by Rudi »

Hi,

i work deep in FC ..
i have many questions:
;-) ;-) ;-)

Where i can read
FC Function for append the right in C Code icon
example

FCI_SCOPY

Where i can read this detailed?

How FC is handle Function like this:

FCI_SCOPY("WOSAMMA",8, FCV_RUDI1,FCVsz_RUDI1);
FCI_SCOPY(FCV_RUDI2,FCVsz_RUDI2, FCV_RUDI1,FCVsz_RUDI1);

Where i can read the Parameters for this example FCVsz_RUDI1

This example is C Code in FC after i declare in Calculation
the String Variable Rudi1 with Value "WOSAMMA"
the String Variable Rudi2 with Value from Stringvariable Rudi1

In Calculation
Rudi1 = "WOSAMMA"
Rudi2 = Rudi1

why i ask:

i make variable in Variable Manager
i make a C code icon for Testing Variable for later include it over extern File..
If i make Byte Variable this run ok
But if i make String Variable, this work not.
I try to add the original String Variable from variable Manager by drag and drop from Variable Manager to C Code icon window...
same, i get Compiler stopp..

If i "copy" the C Code, that make a Calculation ICON like this

// Calculation
// Calculation:
// Rudi1 = "WOSAMMA"
// Rudi1 = Rudi2
FCI_SCOPY("WOSAMMA",8, FCV_RUDI1,FCVsz_RUDI1);
FCI_SCOPY(FCV_RUDI2,FCVsz_RUDI2, FCV_RUDI1,FCVsz_RUDI1);

in the C Code icon, the compiler will work.
But i do not know how this function can be make,
i missed the help for "FC Language"..
where i can read this function parameter for a String to string declare i have think this is enough in C Code Icon

FCV_STRING1 = FCV_STRING2

or

FCV_STRING1 = "HALLO";

but this only goes with Byte...


this Standard C Code..

char string[] = "the best things in Live are FC";

does not go.

or

string[0] = 'D';



________________


The follow C Code Icon will go:

_________________

/*
Enter C code below this comment
*/


// Whats wrong to this String declare ?

// FC String Variable to FC String Variable not gone
// FCV_RUDI1 = FCV_RUDI2;


// String Value to FC String Variable not gone
// FCV_RUDI1 = "NOT GO";

// Try for manually ..

// Taken from Calculation
// Calculation:
// Rudi1 = "WOSAMMA"
// Rudi1 = Rudi2
FCI_SCOPY("WOSAMMA",8, FCV_RUDI1,FCVsz_RUDI1);
FCI_SCOPY(FCV_RUDI2,FCVsz_RUDI2, FCV_RUDI1,FCVsz_RUDI1);


// Byte ( Num Value ) to FC Byte Variable is going
FCV_NUMBYTE1 = 200;


// FC Byte Variable to FC Byte Variable is going
FCV_NUMBYTE1 = FCV_NUMBYTE2;

-----------------------------------------------

the Byte variable is going - but why this not go with String Variable?

In Calculation Icon for the Byte Variable is simple understand the declare...

// Calculation
// Calculation:
// // Rudi1 = "WOSAMMA"
// // Rudi1 = Rudi2
// NumByte1 = NumByte2
FCV_NUMBYTE1 = FCV_NUMBYTE2;

In Calculation icon for the String Variable looks like needs to know more if this the Parameters to need for String Variable = String Variable


// Calculation
// Calculation:
// // Rudi1 = "WOSAMMA"
// Rudi1 = Rudi2
// NumByte1 = NumByte2
FCI_SCOPY(FCV_RUDI2,FCVsz_RUDI2, FCV_RUDI1,FCVsz_RUDI1);
FCV_NUMBYTE1 = FCV_NUMBYTE2;

.....

ok

Thank you!
Best wishes!
Rudi
;-)

PS

Many questions ;-) ;-)
I know, but i will learn this deep,
if i have answeres, i can work deeper and deeper and can help someone in questions too..
and i can make crazy projekts..;-)

FC is great MM Staff!!
FC has many many many hidden features, the potential of FC is more as 300 Procent undetected ( possitive mean )
I will deeper work next Time with the XML ...

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: Questions FCI_SCOPY ... String Variable in C Code Icon

Post by Rudi »

;-(

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: Questions FCI_SCOPY ... String Variable in C Code Icon

Post by Rudi »

i search in CAL Documentation.pdf
This is named "Flowcode V5 CAL ( Code Abstraction Layer) Documentation.
..................^^^^^^^^^^^^^^

my first quest, Is there a CAL Documentation.pdf for the Flowcode V6 ?
..
online?

ok.
i read
Under String CAL :
char* FCI_SCOPY(char* sSRC, char iSrc_len, char* sDst, char iDst_len);

..
this is the Function

FCI_SCOPY("WOSAMMA",8, FCV_RUDI1,FCVsz_RUDI1);

that FC6 is insert for a Calculation
Rudi1 = "WOSAMMA"


FCI_SCOPY.. ok
char* sSRC .....ok i think this stands for Char.. stringSource...so my String is "WOSAMMA"
char iSrc_len ... ok i think this stands for char as number ..i=integer..Src_len.. Source length..so WOSAMmA is 7 long .. i think i must calculate the null term \n as +1 byte so length = 8

now begins next questions..
char* sDst, char iDst_len
this two ..i can not declare..understand..
ok i try...
char* sDst .. i think this is the sTring Destination to.. so the Flowcode Variable from Variable Manager FCV_RUDI1 is right..
char iDst_len.... must be FCVsz_RUDI1.. but how is this decalared for understand..
FCV..FlowcodeVariable ok
sz? sume+zero?..

the char iDst_´len i think must be a char as integer for the DesinationString_length ? and this in FC is in the FC Variable fix "FCVsz_"...VariableName

..
ok...
and this then:
FlowCode Instruction Copy...( From Variable, From Length, To Variable, To Length );
FCI_SCOPY....................(FCV_RUDI2,..................FCVsz_RUDI2, ...................FCV_RUDI1,FCVsz_RUDI1);
.CAL FUNCTION...............FC Variable Name Rudi2, ..LENGTH from the Variable, .......


right?

Where is the Docu to this all? and the interna abbreviations?

edit:

and where stand , if i make a string variable in c code icon
that i can not drag and copy the variable from variable manager...
that i must make a FlowCodeInstruction_COPY...

and if i make a byte variable,
i can drag and copy this from variable manager..

why is the varable manager named variable manager?

;-(

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Questions FCI_SCOPY ... String Variable in C Code Icon

Post by LeighM »

Hi Rudi,

Your confusion is probably because Flowcode language is different to C language

In Flowcode you can copy a string (from one buffer to another) by a simple statement:
Sting1 = String2
This will copy the contents of the String2 buffer into the String1 buffer,
remember that the string buffers contain a sequence of byte characters.
This cannot be done in C in the same way.
A single C assignment can copy a single variable, such as a byte or an integer, but not the contents of a buffer.
(This has to be done by copying each individual byte character one at a time from one buffer to the other)

So for the downloaded C code, Flowcode uses the FCI_SCOPY function to copy the string.

The FCVsz_xxx is the size of the buffer allocated to the string

So a string variable:
MyString[30]

Creates the following C code:
#define FCVsz_MYSTRING 30
MX_GLOBAL MX_CHAR FCV_MYSTRING[FCVsz_MYSTRING];

FCV_MYSTRING is the variable name and FCVsz_MYSTRING is its buffer size

hence:
// MyString = "Hello"
FCI_SCOPY("Hello",6, FCV_MYSTRING, FCVsz_MYSTRING);

This copies the 6 characters of Hello into the FCV_MYSTRING buffer, which has a maximum size of FCVsz_MYSTRING


Flowcode needs to be aware of the variables if it is to do anything with them.
If they are defined in C icons then they are invisible to it.

Regards,
Leigh

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: Questions FCI_SCOPY ... String Variable in C Code Icon

Post by Rudi »

Hi Leigh,
Ty...
LeighM wrote:Hi Rudi,

Your confusion is probably because Flowcode language is different to C language

In Flowcode you can copy a string (from one buffer to another) by a simple statement:
Sting1 = String2
This will copy the contents of the String2 buffer into the String1 buffer,
remember that the string buffers contain a sequence of byte characters.
A String is A Array of Bytes..
ok...
LeighM wrote:
This cannot be done in C in the same way.
A single C assignment can copy a single variable, such as a byte or an integer, but not the contents of a buffer.
(This has to be done by copying each individual byte character one at a time from one buffer to the other)

So for the downloaded C code, Flowcode uses the FCI_SCOPY function to copy the string.
Ok.. but where i can read this?
In the Variable Manager i can drag & copy a Byte Variable like it is to the C Icon ...
and this is right...

if i drag & Copy a "String" Variable to the C Icon it can be copied...
but this runs not in compiler..
so here two future request:
a) the Variable Manager will include the "FlowCodeFunction" FCI_SCOPY... to the C Icon
or
b) the Variable Manager will popup a MsgBox "This can only done with Byte Variable.. if you want to copy this to C Icon it must be functional with FCI_SCOPY...."
...

In one Time i can "click" code
in other i must know, what i can click and what i must declare expicite...
this not correct i mean.. without Docu this is like a "Gambling"...

LeighM wrote:
The FCVsz_xxx is the size of the buffer allocated to the string

So a string variable:
MyString[30]

Creates the following C code:
#define FCVsz_MYSTRING 30
MX_GLOBAL MX_CHAR FCV_MYSTRING[FCVsz_MYSTRING];

FCV_MYSTRING is the variable name and FCVsz_MYSTRING is its buffer size

hence:
// MyString = "Hello"
FCI_SCOPY("Hello",6, FCV_MYSTRING, FCVsz_MYSTRING);

This copies the 6 characters of Hello into the FCV_MYSTRING buffer, which has a maximum size of FCVsz_MYSTRING


Flowcode needs to be aware of the variables if it is to do anything with them.
If they are defined in C icons then they are invisible to it.

Regards,
Leigh

Yes Leigh, but where i can read this?
Where is the Docu to this all? and the interna abbreviations?
The next will ask the same.. ;-)

..
..
i am foxi ;-( ..
i try to understand FC .. but in next moment, the logic is fly away...
please, if i can not drag and drop a string variable from variable manager to the c code icon, that runs...
why is this then possible to drag ... ...
please make a test:

open a new projekt,
simple append a c code icon
make with variable manager a btye variable named: Testa
and give them the init value : 1
then make a second byte variable named: Testb
and give them the init value : 2
then click at the c icon double
now you see left the c code window, right the variables..
you can click on the variable Testa and can drag and copy to the c icon windows
then make a space and a = and a space.
then click on the variable Testb and you can drag and copy to the c icon windows.
then finish the line in c icon window..with semicolom
in c icon window is now:

...
FCV_TESTA = FCV_TESTB;

ok?..

ok.. this runs perfect in compiler..

now make this with a string variable named STesta and STestb same procedure..

it can be do!
The Variable Manager do not warn !you must make a FCI_SCOPY....
or
insert the FCI_SCOPY "Flowcode" language ...

but in C Code Icon is now:

...
FCV_TESTA = FCV_TESTB;

FCV_STESTA = FCV_STESTB;


and the second line is wrong.


Best wishes
Rudi

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: Questions FCI_SCOPY ... String Variable in C Code Icon

Post by Rudi »

why i am so:

because i have test with byte in first time.
so i have understand that i can incude a file with many byte variable and can give it values..
so i have make my byte variables with excel...

this run..
now
with the try in variable manager, that byte variable can drag and copy..
i think .. that must go on with string variable too?..
so i test the drag and drop with string variable and it can be copied..

so i have start to build my string list fine in excel too ( At Commands many text )
i was happy that i do not make this with variable manager step by step..
i hope you understand me..

and if i was finnish, and want to try to include the file.. compiler stops...
the logic was wrong.. ;-(/ the strategie too. so the excel with strings was waste...

so i read from the xml possible in project.. ok this fine...
but.. ... i will not write xml code ;-) ... i will make code Mikrocontroller fast by click code.. ;-)... in grafical mode like Flowchart..
..
..
..
please!
Where ist all the Documentation for this to understand this better.
I missed this much. I hope you understand.
Best wishes
Rudi

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: Questions FCI_SCOPY ... String Variable in C Code Icon

Post by Rudi »

...

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: Questions FCI_SCOPY ... String Variable in C Code Icon

Post by Rudi »

LeighM wrote:
So a string variable:
MyString[30]

Creates the following C code:
#define FCVsz_MYSTRING 30
MX_GLOBAL MX_CHAR FCV_MYSTRING[FCVsz_MYSTRING];

FCV_MYSTRING is the variable name and FCVsz_MYSTRING is its buffer size

hence:
// MyString = "Hello"
FCI_SCOPY("Hello",6, FCV_MYSTRING, FCVsz_MYSTRING);

This copies the 6 characters of Hello into the FCV_MYSTRING buffer, which has a maximum size of FCVsz_MYSTRING
Ok Leigh,

i try one time again..

--is there a possible to get the Strings Value from a extern Text File to the String Variables?


Like this

only as a ! C Code Icon
============================


#define FCVsz_ATC01 30
#define FCVsz_ATC02 30
#define FCVsz_ATC03 30
#define FCVsz_ATC04 30
#define FCVsz_ATC05 30
#define FCVsz_ATC06 30
#define FCVsz_ATC07 30
#define FCVsz_ATC08 30
#define FCVsz_ATC09 30
#define FCVsz_ATC10 30
#define FCVsz_ATC11 30
#define FCVsz_ATC12 30
#define FCVsz_ATC13 30
...

MX_GLOBAL MX_CHAR FCV_ATC01[FCVsz_ATC01];
MX_GLOBAL MX_CHAR FCV_ATC02[FCVsz_ATC02];
MX_GLOBAL MX_CHAR FCV_ATC03[FCVsz_ATC03];
MX_GLOBAL MX_CHAR FCV_ATC04[FCVsz_ATC04];
MX_GLOBAL MX_CHAR FCV_ATC05[FCVsz_ATC05];
MX_GLOBAL MX_CHAR FCV_ATC06[FCVsz_ATC06];
MX_GLOBAL MX_CHAR FCV_ATC07[FCVsz_ATC07];
MX_GLOBAL MX_CHAR FCV_ATC08[FCVsz_ATC08];
MX_GLOBAL MX_CHAR FCV_ATC09[FCVsz_ATC09];
MX_GLOBAL MX_CHAR FCV_ATC10[FCVsz_ATC10];
MX_GLOBAL MX_CHAR FCV_ATC11[FCVsz_ATC11];
MX_GLOBAL MX_CHAR FCV_ATC12[FCVsz_ATC12];
MX_GLOBAL MX_CHAR FCV_ATC13[FCVsz_ATC13];

...
...

// A simple "Procedure"
// XML
// PERL
// ...
// EXTERN TOOLS..
// that read a extern text file 0.. . eof
// the Value will be example in a text file like this
// AT+CONFIGSAVE=SSID\r\n
// AT+CONFIGALL=IP\r\n
// AT+CHECK=SERVERMODE\r\n
// ..
// ..

// then.. copy the read string to the variable 0...eof


FCI_SCOPY(READSTRING01,30, FCV_ATC01, FCVsz_ATC01);
FCI_SCOPY(READSTRING02,30, FCV_ATC02, FCVsz_ATC02);
FCI_SCOPY(READSTRING03,30, FCV_ATC03, FCVsz_ATC03);
FCI_SCOPY(READSTRING04,30, FCV_ATC04, FCVsz_ATC04);
FCI_SCOPY(READSTRING05,30, FCV_ATC05, FCVsz_ATC05);
FCI_SCOPY(READSTRING06,30, FCV_ATC06, FCVsz_ATC06);
FCI_SCOPY(READSTRING07,30, FCV_ATC07, FCVsz_ATC07);
FCI_SCOPY(READSTRING08,30, FCV_ATC08, FCVsz_ATC08);
FCI_SCOPY(READSTRING09,30, FCV_ATC09, FCVsz_ATC09);
FCI_SCOPY(READSTRING10,30, FCV_ATC10, FCVsz_ATC10);
FCI_SCOPY(READSTRING11,30, FCV_ATC11, FCVsz_ATC11);
FCI_SCOPY(READSTRING12,30, FCV_ATC12, FCVsz_ATC12);
FCI_SCOPY(READSTRING13,30, FCV_ATC13, FCVsz_ATC13);


...

this will save a lot of time with the Variable Manager..

ok .. i can make the projekt file *.fcfx edit ( xml ) and can add variable.. ok...
but then the variable fix..if i will delete or change i must work with variable manager step in step
or again with a editor the xml nodes in *.fcfx..
but this allways.. a reload must done too...
...

i hope you understand my background thinking...
its comfortabler and faster to edit this by a file... extern. separat.

its easy ier to make flexibel
"menu files"
"at commands"
"string lists"

from any someone.. ( menu designer ... comand designer... stringdesigner... )

as edit in a *.fcfx file.. that is need in the project and would allways update new if the coder works in the project.

so the "designer" can work by himself
so the "coder" can work at project by himself and in C Code icon is a Place Holder for the "Designer"... // Example // Resource //
is it there than is ok
is it no Value, is ok too -

the designer can be all languages..
the designer can be groups of menu ect...
this is flexibler as Variable Manager or XML in *.fcfx...
..
..
..


EDIT:

This makes possible work in a Team.
The Coder
The Menu Designer
The Translater ( Language )
ect....

Post Reply