On a 18F2550, the arrays sometimes don't react as they should.
On the attached file (Robot_ir_v4testbug2.fcf), I highlighted the problem.
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
Somebody have an explanation for that?
array strange behaviour
-
- Posts: 155
- Joined: Sat Mar 28, 2009 5:44 pm
- Location: LYON FRANCE
- Has thanked: 3 times
- Been thanked: 41 times
- 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
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).
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).
-
- 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
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.
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.
- 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
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.
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.