CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

array problems

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Anoni
Guest







array problems
PostPosted: Sun Jul 01, 2007 1:31 pm     Reply with quote

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







PostPosted: Sun Jul 01, 2007 1:34 pm     Reply with quote

I forgot to mention that I use v4 compiler for PIC18F6527 device.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 01, 2007 2:14 pm     Reply with quote

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







PostPosted: Sun Jul 01, 2007 3:07 pm     Reply with quote

v4.042 and I use 16-bit pointers
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 01, 2007 3:37 pm     Reply with quote

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







PostPosted: Sun Jul 01, 2007 5:28 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sun Jul 01, 2007 7:00 pm     Reply with quote

I don't know, but it's not supported and it causes erratic operation,
so you need to always disable it.
Anoni
Guest







PostPosted: Mon Jul 02, 2007 7:20 am     Reply with quote

Changing XINST to NOXINST solved all problems.

Thank You PCM programmer
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group