View previous topic :: View next topic |
Author |
Message |
Anoni Guest
|
array problems |
Posted: Sun Jul 01, 2007 1:31 pm |
|
|
Could somebody explain what causes the following:
An array declared as: int8 a[256];
and accessed with a[5] for example returns garbage in some of the project files. I replaced a[5] with *(a+5) and that seemed to fix the problem. In other files in the same project *(a+5) does not work, but a[5] does work. I get no compilation errors and the scope of a[] is maintained properly with #include directives.
Thanks in advance. |
|
|
Anoni Guest
|
|
Posted: Sun Jul 01, 2007 1:34 pm |
|
|
I forgot to mention that I use v4 compiler for PIC18F6527 device. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 01, 2007 2:14 pm |
|
|
What's your full compiler version number ? Look at the start of the .LST
file to find it. The .LST file is in your project directory. The version
number is a 4-digit number such as 4.013, or 4.032, or 4.042.
Don't post any numbers that come after the version number. |
|
|
Anoni Guest
|
|
Posted: Sun Jul 01, 2007 3:07 pm |
|
|
v4.042 and I use 16-bit pointers |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 01, 2007 3:37 pm |
|
|
The PCH compiler always uses 16-bit pointers. You don't need to
specifiy #device *=16 with PCH.
Can you post a small test program that shows the problem ?
Or does the problem only occur with a large program ? |
|
|
Anoni Guest
|
|
Posted: Sun Jul 01, 2007 5:28 pm |
|
|
PCM programmer, I will post test code tomorrow. In mean time I read about XINST fuse setting in another thread. Do you think XINST fuse being programmed can cause the problems above?
Thanks for the quick responses. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Jul 01, 2007 7:00 pm |
|
|
I don't know, but it's not supported and it causes erratic operation,
so you need to always disable it. |
|
|
Anoni Guest
|
|
Posted: Mon Jul 02, 2007 7:20 am |
|
|
Changing XINST to NOXINST solved all problems.
Thank You PCM programmer |
|
|
|