Using C code
-
- Posts: 37
- http://meble-kuchenne.info.pl
- Joined: Thu Feb 02, 2023 9:32 pm
- Has thanked: 19 times
- Been thanked: 3 times
Using C code
I am using UART to get a string from a device. I then went to parse/trim that sting before I sent it to the PC. When I "compile to HEX" only the .h and .c files get generated. I think the problem is the C Code icon I am using. When I toggle it off the .hex gets generated. I have attached my code and the error message when the c code not toggled off.
- Attachments
-
- Inspectra_macro.fcfx
- (16.6 KiB) Downloaded 440 times
-
- Inspectra_macro.msg.txt
- (4.32 KiB) Downloaded 244 times
- p.erasmus
- Posts: 434
- Joined: Thu Dec 03, 2020 12:01 pm
- Location: Russia / Россия
- Has thanked: 104 times
- Been thanked: 88 times
Re: Using C code
Hi
What you see is normal FC/Compiler will not generate a hex file if there is an error in the code,
You have an error in the way you are parsing the strings (I would think you should use a loop do that)
anycase the problem is that your C code generates an error and therefore the hex file is not generated
What you see is normal FC/Compiler will not generate a hex file if there is an error in the code,
You have an error in the way you are parsing the strings (I would think you should use a loop do that)
anycase the problem is that your C code generates an error and therefore the hex file is not generated
Regards Peter - QME Electronics
-
- Matrix Staff
- Posts: 1465
- Joined: Sat Dec 05, 2020 10:32 am
- Has thanked: 204 times
- Been thanked: 347 times
Re: Using C code
Your C code is illegal C. Specifically this line:
FCL_BUFFER is declared as an array in Flowcode (local string "buffer[20]").
You are probably best off avoiding C code and using a calculation similar to following:
Code: Select all
// Remove the first 3 characters from the string
FCL_BUFFER = FCL_BUFFER + 3;
You are probably best off avoiding C code and using a calculation similar to following:
Code: Select all
.buffer = Mid$(.buffer, 3, Length$(.buffer)-3)
-
- Matrix Staff
- Posts: 1913
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 619 times
- Been thanked: 644 times
Re: Using C code
To learn more string functions, you can also use within a calculation box:
As this is not a Flowcode bug, I have moved the topic from the Bugs section.
Code: Select all
.buffer = Right$ (.buffer, Length$ (.buffer) - 3)
Martin
-
- Posts: 37
- Joined: Thu Feb 02, 2023 9:32 pm
- Has thanked: 19 times
- Been thanked: 3 times
Re: Using C code
Thank you all! Where can I go to learn more about Length$, Mid$, Right$? They aren't C keywords and there isnt info in the Calculation Icon Properties wiki page.