My program modifies specific file registers, but the expected file register does not change in the FILE REGISTER or in the WATCH window. What could cause this?

Submitted by: TechTools

a) The most common cause for this is forgetting to set or clear the appropriate register bank bit(s) in the STATUS byte. This causes the processor to access the wrong file register. This is not a bug in the assembler or Mathias. The PICmicro® MCU architecture only encodes the file register OFFSET within its OPCODEs. This allows it to perform most operations with a single OPCODE fetch within a single instruction cycle. Of course this is what leads to the "RISC" architecture. It also burdens the programmer with remembering which register bank a particular variable is in, and then presetting/clearing the correct register bank select bits before accessing a file register. The assembler can not predict which path your program will follow so it can not know at compile time whether these bits need to be updated. It would be terribly inefficient for the assembler to blindly set these bits before EVERY file register operation.

b) Another possible cause is a mismatch between the processor targeted by your assembler or compiler, and the processor Mathias is configured to emulate. We have added considerable error checking where possible to reduce the likelihood that these get out-of-sync. However, it ispossibleto fool Mathias. Particularly if you are using something other than CVASM16. If things are looking a little unbelievable, check the project-info settings to insure that you have selected the proper processor to emulate. Also check you compiler/assembler directive settings to insure it is targeting the correct processor.

c) See FAQ1