Thanks guys, it was something Nigel had said earlier:
Nigel Goodwin said:
No 'care' required, you should always save and restore any common registers used (or affected) by your interrupt rourine, this is standard practice, and there's nothing different required for I2C routines.
Sorry to sway away from your original thread, but in response too:
Nigel Goodwin said:
why are we discussing interrupt routines and my I2C routines if you're only using BASIC?.
Got me thinking about that damn problem i had with a basic alarm clock i had made, using TMR0. Every now and then a problem arrised; when I updated the the data on the lcd, the interrupt routine would trigger during a
print statement, and the result would be complete garbage on the lcd screen.
I assumed the system registers like status etc.. were not being saved and restored correctly. In proton+, the command
Context Save and
Context Restore are used before and after interrupt routines, but when compiling the program with these commands, it gives a warning saying that this is done
automatically on the 16 series pics, and is therefore not req.
But it must be missing something, or some register, as my timer interrput routine is really basic, just incrementing integers..?. Why the garbage on the lcd screen..?.
EDIT: The only way i could correct this/stop it from happening was to disable interrupts before a
print command, then enable them afterwards, but that really bugged me as everytime i did this, i was decreasing the accuracy of the clock.