Hi everybody,
hope someone could help me with variables with multiple array indexes...
i use variables with multiple array indexes, because sometimes its more easy to use it and the number of variables is significant less...
first of all, in simulation everything works fine and well, but after compiling on the hardware it fails. during compiling it gives no errors.
my knowledge of arrays is this:
var[10] means 10 variables var from var[0] to var[9]
when i use:
var[2][3] means var[0] has 4 possibilities, var[1] has 4 possibilities, var[2] has 4 possibilities, so a total of 12 possibilities.
Now (see pictures and test program) to show my problem:
Test_str[10][10][20]
Var_fl[10][10]
I made a floating variable with double index array and a string with double index array(string each 20 characters)
The 1st string (2 characters)is not displayed on the hardware (in the simulation works fine)
According to me, when I use a “floattoString” with 2 decimals from a single value it makes a string of 4 characters.
So, if I convert a value to string it will show on the hardware, if I write down a string between “” it won’t show it on the hardware…
Another “strange” thing..
When I make the first string 1 character for example “q”, it will also show on the hardware, but that could not be the solution… the last [20] means 20 characters long…
Is there something I’m doing wrong or maybe a bug during compiling?
Hope someone could help me.
Multiple Arrays Problem
-
- Posts: 4
- http://meble-kuchenne.info.pl
- Joined: Thu Jan 21, 2021 7:36 pm
- Has thanked: 2 times
- Been thanked: 5 times
-
- Matrix Staff
- Posts: 1789
- Joined: Mon Dec 07, 2020 10:06 am
- Has thanked: 455 times
- Been thanked: 621 times
Re: Multiple Arrays Problem
Hello,
Arrays in the flowcode sim will be accepting of going out of bounds but this will not be the case on the micro and you will be going into uninitialised memory, if your lucky
Your program however looks ok so strange this isn't working.
It might be worth trying smaller array sizes your string array is currently 2000 bytes and your float array is 400 bytes. Might be worth going a fair bit smaller and seeing how you get on. Some 8-bit compilers have previously struggled with array sizes > 256 bytes.
The reported BSS size looks to be correct for the current array size so that looks to be working as expected.
I think instead here you have 3 possibilities for var[0] and a further 3 for var[1], 2*3 = a total of 6 possibilities.var[2][3] means var[0] has 4 possibilities, var[1] has 4 possibilities, var[2] has 4 possibilities, so a total of 12 possibilities.
Arrays in the flowcode sim will be accepting of going out of bounds but this will not be the case on the micro and you will be going into uninitialised memory, if your lucky
![Wink ;)](./images/smilies/icon_e_wink.gif)
Your program however looks ok so strange this isn't working.
It might be worth trying smaller array sizes your string array is currently 2000 bytes and your float array is 400 bytes. Might be worth going a fair bit smaller and seeing how you get on. Some 8-bit compilers have previously struggled with array sizes > 256 bytes.
The reported BSS size looks to be correct for the current array size so that looks to be working as expected.
Regards Ben Rowland - MatrixTSL
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel
Flowcode Online Code Viewer (Beta) - Flowcode Product Page - Flowcode Help Wiki - My YouTube Channel