> >-----Original Message----- > >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] > >Sent: 27 April 2005 14:56 > >To: Microcontroller discussion list - Public. > >Subject: RE: [PIC] HiTech C and Local Variables > > > > > >Hi Mauricio, > > > >Thanks for your post. TBH I've been doing that for the last > >few days. (divide and conquer - the most basic debug approach > >of course.) It's proving extremely hard to pin down though. > >Keep plugging away I know! ;) > > > >The fact that no one so far has said "yes, HiTech C can cause > >trouble sometimes with local vars" indicates at least it is > >probably my fault and not the compiler, so I am in a position > >to deal with it I think. > > > >James > > > James, > > Yes, Hitech can cause trouble sometimes with local vars! However, only > under very specific circumstances. If you enable optimisations, the > compiler attempts to use as many redundant (for that function) SFR's as > possible to contain local variables, such as PRODH, PRODL, FSRx etc. If > you include inline assembly that uses these registeres, the compiler > can't "see" it, so local variables can get scrubbed unintentionaly. > > Regards > > Mike > Hi Mike, Thank you for the info! That is interesting. I did try turning off all optimizations, (compiler and assembler) in case it might be the cause of the trouble, but it made no difference in my case - more evidence that it's my code at fault, somewhere... James -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist