如系統遭受EMI影響,系統行為 erratically,也就是使 PC(program counter )已不正確。This is called code-runaway.
未使用的Flash memory 其值為0xFF. 若程式執行時會將其解讀為 ' LDS $FFFF '
A simple solution is to fill unused Flash with $3F, the op-code for the SWI instruction. As this is a single byte instruction, it will always be executed correctly. The microcontroller will fetch the Software Interrupt Vector and execute the code at the address.
If the Software Interrupt is required by the application, an alternative solution is to use 'Implemented Instrutction' interrupt. As all page 1 op-codes are valid, it is necessary to choose a page 2 op-code. Filling unused Flash with $18A7 will cause an 'Unimplemented Instruction' interrupt if the CPU attempts to execute this op-code. $18 is pre-byte to select page 2, and $A7 is unimplemented on page 2. If the $A7 is read first, this will be interpreted as a NOP instruction and the next $18A7 will be read.
No comments:
Post a Comment