• Do not set registers to prohibited values.
It is impossible to predict what kind of operation will occur if a register is set to a prohibited value.
• Do not write or overwrite a prohibited register.
It is impossible to predict what kind of operation will occur if an access-prohibited register is accessed.
However, even when overwriting is prohibited, writing the same value does not cause a problem.
Note that some emulators can discover illegal accesses because executing a program that writes to a read-only register triggers a forcible break and causes the program to terminate with an error.
• Do not allocate a microcontroller program to a memory area where it cannot be fetched.
A program cannot be executed if it cannot be fetched.
• When the microcontroller executes multiple interrupt servicing, sufficient stack area must be secured in the RAM to allow for the assumed nesting.
If data or the program is overwritten by extending the stack area for multiple interrupt servicing, it is impossible to predict what kind of operation will occur.
• The option byte(s) must be set in flash memory microcontrollers with option byte(s).
With mask ROM products, the options are specified using a coding sheet (user-specified mode) when the product is ordered with the user's ROM code, and then the options are fixed by hardware. With flash memory products, however, the options are specified by software, so these options must be set when the program created in assembly language is written.
• If the microcontroller program is written in C language, a startup routine is required to execute initialization.
If there is no startup routine, the peripheral function registers and the variables cannot be initialized.
• Do not start up a program in a semiconductor device that has an on-chip oscillator before oscillation has stabilized.
It is impossible to predict what kind of operation will occur if the device operates on an unstable clock.
If there exists a peripheral device that is being supplied with clock from an oscillator that differs from the clock being supplied to the microcontroller, program the microcontroller so that it does not access that peripheral device until the peripheral device's clock has stabilized.
Note that some microcontrollers with on-chip oscillators allow an oscillation stabilization wait time to be set with an internal timer, and the oscillation status to be checked with a flag. The microcontrollers can be made to insert the oscillation stabilization wait time at startup by setting option bytes, the wait time can be programmed to be inserted following startup using software.