array strange behaviour

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

Moderators: Benj, Mods

Post Reply
benp
Posts: 155
Joined: Sat Mar 28, 2009 5:44 pm
Location: LYON FRANCE
Has thanked: 3 times
Been thanked: 41 times

array strange behaviour

Post by benp »

On a 18F2550, the arrays sometimes don't react as they should.
On the attached file (Robot_ir_v4testbug2.fcf), I highlighted the problem.
Robot_ir_v4testbug2.fcf
(35.65 KiB) Downloaded 272 times
I test an array at the begginning of my software not modified (a line follower robot with RC5-IR remote control)

If I write in a calculation box:
--------------------
xcapt[1] = 7
c = 1
MODE = xcapt[c]
----------------------
If I ask for an output on the LCD, I have
xcapt[1] -> 7 on LCD
xcapt[c] -> 8 on LCD
MODE -> 8 on LCD
It should be should be 7/7/7. Simulation give 7/7/7

If I copy the code in a new program, the result is OK (7/7/7)
The same code in a bigger programm can sometime be OK (7/7/7) too. The result is OK on the file: Robot_ir_v8_0bug.fcf
Robot_ir_v8_0bug.fcf
(79.88 KiB) Downloaded 277 times
Somebody have an explanation for that?
Regards
INSA 1er cycle GCP projects with or without eblocks:
http://www.youtube.com/user/INSAgcp

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: array strange behaviour

Post by Steve »

Please post the C code file that was generated.

benp
Posts: 155
Joined: Sat Mar 28, 2009 5:44 pm
Location: LYON FRANCE
Has thanked: 3 times
Been thanked: 41 times

Re: array strange behaviour

Post by benp »

Here is the generated c code
File with bug:
Robot_ir_v4testbug2.c
(41.69 KiB) Downloaded 315 times
File with no bug:
Robot_ir_v8_0bug.c
(77.3 KiB) Downloaded 302 times
Regards
INSA 1er cycle GCP projects with or without eblocks:
http://www.youtube.com/user/INSAgcp

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: array strange behaviour

Post by Steve »

I can't see anything obviously wrong with the C code that is generated.

It would help if you can create a very simple program that shows this problem and then send us all of the files that are generated (.fcf, .c, .casm, .asm, etc).

benp
Posts: 155
Joined: Sat Mar 28, 2009 5:44 pm
Location: LYON FRANCE
Has thanked: 3 times
Been thanked: 41 times

Re: array strange behaviour

Post by benp »

I found where the problem come from.
There is a bug when:
"Extended CPU enable" is set" to "enable"
There is no bug when:
"Extended CPU enable" is set" to "disable"
The problem is solved for me.
I don't know if flowcode should work with enable.
Regards
INSA 1er cycle GCP projects with or without eblocks:
http://www.youtube.com/user/INSAgcp

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: array strange behaviour

Post by Steve »

Thank you very much for solving this problem!!

I've just looked on the BoostC forums and it says there that the BoostC compiler does not support this XINST configuration setting in the 18F2550 and that it can cause problems with accessing variables in RAM.

Post Reply