The thing is that the code works perfectly most of the time for thousands of iterations. Then suddenly *the same part of the code* do something erratically. Like if some value was overwroitten by an interrupt or something. But that happens also with interrupts globally disabled... /Morgan Den 2007-08-28 00:06:35 skrev Harold Hallikainen : > Regarding functions returning values different than what was in the > function, make sure the code that calls the function has the correct > prototype for the function. If, for example, the header file is not > specified, the compiler assumes functions return an int, which is often > not the case! > > Hope that is SOME help. > > Harold > Been there, done that... > > -- Morgan Olsson -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist