Hi, James. I had troubles with RAM in F877's some time ago. PICC 8.05PL2, and MPLAB5.x. It was a difficult problem to track, as yours, but in my case i was experimenting resets now and then... impossible to track with the emulator. Only happening in the "real" environment. Finally i came across a problem with a vector index getting crazy (my guilt, of course). PICC uses the FSR to access vectors, so a wrong index can access anywhere in the RAM. In my case, it was accessing the program counter, and that was the cause for the resets. PICC puts local and static variables in different places, thus changing your local variable to static can get it away from the problem. But the problem is still there. I've updated past month to 8.03PL3 (untill the end of some projects), so I have little experience with this release. But no problem so far. Regards, Alvaro Deibe Diaz. > -----Mensaje original----- > De: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] > En nombre de James > Enviado el: martes, 26 de abril de 2005 14:44 > Para: Microcontroller discussion list - Public. > Asunto: [PIC] HiTech C and Local Variables > > I'm wondering if anyone else has come across strange > behaviour sometimes when using local function variables with > HiTech's PIC C compiler (latest version - 8.05PL2, and also 8.03PL3)? > > The contents of temporary local variables in some of my > functions are getting overwritten without reason. By changing > them to static it fixes the problem. > > I'm having to allocate a lot of the other variables in 3 of > the banks, so I'm wondering if that is a cause? I've turned > off all optimization and it still happens. At no point does > any of my code write to an address in RAM except via a > pointer to a variable, so I can't see how these variables are > getting overwritten. > > What makes it so much harder to track down is that it doesn't > happen in the MPLAB similuator but only when I program the > PIC, of course! ;) So I'm debugging with a scope and some > diagnostic pin output... > > I've been using this compiler for a couple of years without > this trouble before, but with this code it's happening all > over the place. I've never targeted this PIC (16F876A) > before, but I doubbt that's central to it. > > I could raise this on HiTech's forum but that gets little > traffic. I'm really looking for any experiences from people > here that could backup or otherwise what I think I'm seeing! > Many thanks. > > James > > -- > http://www.piclist.com PIC/SX FAQ & list archive View/change > your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist