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

Locating Cause of Bit Corruption

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



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

Locating Cause of Bit Corruption
PostPosted: Sat Mar 10, 2007 3:06 pm     Reply with quote

3.236
18F2620


Hello All,

This is an ongoing problem that I was thought caused by a large array but it appears now that an int1 variable is getting corrupted and I need some help disecting the LST files.

If I declare and initialize an int1 flag variable in the MAIN section of code, it is corrupted under a very precise circumstance. I've checked to make sure I'm not using a = when I want to use ==, etc.

If I declare it outside of MAIN or make it STATIC inside MAIN the problem goes away.

Any suggestions? I'd be glad to post any more snippets that may help, code or LST.

Thanks,

John


Causes Problems:

Code:
....................    //------ Ambience Support
....................    int1  ambience_status  = 0;        //ambience on or off
1CF4:  BCF    x36.1
....................    int1  amb_spoolup_stat = 0;        //ambience spooled up
1CF6:  BCF    x36.2
....................    int8  ticks = 0;                   //counter
1CF8:  CLRF   x43
....................    int8  ticks_to_next_event = 0;
1CFA:  CLRF   x44
....................    int1  next_event = 1;              //flag for event type, 1 = on, 0 = off
1CFC:  BSF    x36.3
....................    int16 index_for_event = 0;         //index of unit to turn on or off
1CFE:  CLRF   x45
1D00:  CLRF   x46
....................


Doesn't:
Code:
....................    //------ Ambience Support
....................    static int1  ambience_status  = 0;        //ambience on or off
....................    int1  amb_spoolup_stat = 0;        //ambience spooled up
1CF6:  BCF    x36.1
....................    int8  ticks = 0;                   //counter
1CF8:  CLRF   x43
....................    int8  ticks_to_next_event = 0;
1CFA:  CLRF   x44
....................    int1  next_event = 1;              //flag for event type, 1 = on, 0 = off
1CFC:  BSF    x36.2
....................    int16 index_for_event = 0;         //index of unit to turn on or off
1CFE:  CLRF   x45
1D00:  CLRF   x46
....................
Ttelmah
Guest







PostPosted: Sat Mar 10, 2007 3:57 pm     Reply with quote

Look at the symbol table.
What is stored in location 0x35?. What operations do you perform on this?. The fault is fairly 'classic', for something just in front of the variable, overwriting it. When you declare it as static, it is put into a different memory location.

Best Wishes
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Sat Mar 10, 2007 6:18 pm     Reply with quote

RJ,

Thanks. Now it's even more bizarre. The location previous is an int8 variable declared and initialized right before the flag variable. The strange thing is, it's not ever used... it was an old index variable that was left over from some old code.

I'm looking further upstream and I'll let you know if I find anything.

John
jecottrell



Joined: 16 Jan 2005
Posts: 559
Location: Tucson, AZ

View user's profile Send private message

PostPosted: Sat Mar 10, 2007 7:40 pm     Reply with quote

I finally tracked it down to a mix of types in an equation to find an array index.....
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