On Tue, 2006-08-29 at 11:09 -0400, Olin Lathrop wrote: > Herbert Graf wrote: > > Only right at the end did I discover it was a compiler bug. > > Why, do you usually keep looking once you discover it's a compiler bug? I don't really understand the question? I think the answer is yes, since usually once I discover a tool issue, the next step is either solving the tool issue (by checking support), or working out a way that bypasses the tool issue (which can take a while). In this case however, once I found the tool issue, the "workaround" was obvious, so my work on the bug was finished. To clarify I knew I had a bug. The whole time I assumed the problem was my code. After checking things in my code as far as I could I decided the problem must be outside my code (I had condensed the code to such a simple chunk that it was clear to me the problem wasn't the code). That left me with three suspects, the compiler, the programmer and the PIC. The programmer and PIC were less likely the source of the problem then the compiler, so I decided to look into what the compiler was generating. I took out the manual, figured out how to get the compiler to generate the asm listing and started investigating. On close inspection (and keeping track of bank settings, which isn't easy since compiler generated ASM often jumps around a lot) I discovered the bank bits were wrong for one of the SFRs I was using. (BTW this is exactly the kind of situation that makes me recommend everybody who uses a PIC has at least a basic understanding of ASM before going to an HLL. I started with ASM so looking at the ASM produced by the compiler was no big deal. A person with no familiarity with ASM would have been faced with both learning ASM, and THEN figuring out what was wrong). I added a manual setting of the bank bits to the C code, recompiled, confirmed the bank settings were in the ASM file, programmed the PIC, and the problem was gone. As I said before, I have no doubt that the HiTech C product these days is WAY better then the version I used. Unfortunately I'll probably never find out. TTYL -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist