Page 1 of 1

String array problem

Posted: Fri May 12, 2017 10:02 am
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

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,


Re: String array problem

Posted: Fri May 12, 2017 11:22 am
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.

Re: String array problem

Posted: Fri May 12, 2017 11:33 am
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



Re: String array problem

Posted: Fri May 12, 2017 11:40 am
by LeighM
Maybe you could try this, to trick Flowcode into increasing the copy count...

Code: Select all

I should have tried that whilst I had the MIAC out of its box :oops:

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

Re: String array problem

Posted: Fri May 12, 2017 12:07 pm
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?



Re: String array problem

Posted: Fri May 12, 2017 12:32 pm
by LeighM
answering that is above my pay grade :lol:

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