String array problem

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

Moderator: Benj

Post Reply
User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

String array problem

Post by petesmart »

Hi Leigh, Ben,

working with dsPic miac and I have come across a problem in trying to use string arrays – see attached

I'm trying to set up a 5 x 20 character text matrix for later recall in a dynamic menu navigation display.

I am using

Code: Select all

 mystring[5][20]
The variable can be set up without any errors – however when I'm trying to write to the individual location on the matrix for example mysting[2]="test" it appears to default to mystring[0] – as you are stepping through my program example have a look at the value in the simulation debugger window – it always of defaults to 0 position

I have checked the functionality against the standard byte[x][x] syntax and that appears to function okay

I've also check this on the hardware – the problem is not limited to simulation – hardware exhibits the same result

is this a bug or do I not have the syntax correct?

by the way – loving the simulation console functionality! :D

Thanks for your assistance.

All the best,

Pete
Attachments
string array test.fcfx
(9.58 KiB) Downloaded 223 times
sorry about that Chief!

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: String array problem

Post by LeighM »

Hi Pete,

Thanks for your investigations.

It looks like Flowcode does not support arrays of strings, or at least they were most likely not in the original plan but crept up on us.
There are certainly a few issues identified there.
The simulation is certainly not supporting the array properly.

But looking at the generated C and asm files, as you noticed, things look fairly close to working.
As far as I can see from the asm, both of the strings should copy to the correct location,
there is a “but”, in that Flowcode is limiting the string copy (byte count) to the wrong value, to the number of items (5) rather than the string size (20).
I’ve now tried this on a MIAC and confirmed the above.

I’ll log the issue here and see what can be done to improve things.
Thanks.
Leigh
Attachments
string array test 2.fcfx
(10.36 KiB) Downloaded 243 times

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: String array problem

Post by petesmart »

Thanks for the follow up Leigh....any thoughts on a work around?

I was trying not to chew up a lot of variable names

best

Pete
sorry about that Chief!

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: String array problem

Post by LeighM »

Maybe you could try this, to trick Flowcode into increasing the copy count...

Code: Select all

mystring[20][20]
I should have tried that whilst I had the MIAC out of its box :oops:

Simulation, now that's a different matter :roll:

User avatar
petesmart
Valued Contributor
Valued Contributor
Posts: 395
Joined: Thu May 06, 2010 11:42 am
Location: Sydney, Australia
Has thanked: 187 times
Been thanked: 140 times
Contact:

Re: String array problem

Post by petesmart »

aaaahhhh.... now thats very clever! :lol:

MIAC performs as you would expect :D

Simulation still the same as you suggested

Is simulation hard to fix?

best

Pete
sorry about that Chief!

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: String array problem

Post by LeighM »

answering that is above my pay grade :lol:

we'll have to wait until our Flowcode/Windows programmers get on the case

Post Reply