ST10R272L - CENTRAL PROCESSING UNIT
44/320
direction should be followed by an instruction that does not access the same port, for
example:
Changing the system configuration
The instruction following an instruction that changes the system configuration via register
SYSCON (e.g. segmentation, stack size), cannot use the new resources (e.g. stack). In
these cases, an instruction that does not access these resources should be inserted.
BUSCON/ADDRSEL
The instruction following an instruction that changes the properties of an external address
area, cannot access operands within the new area. In these cases, an instruction that does
not access this address area should be inserted. Code accesses to the new address area
should be made after an absolute branch to this area.
Note
As a rule, instructions that change external bus properties should not be executed
from the respective external memory area.
Updating the stack pointer
An instruction that changes the contents of the stack pointer SP (MOV, ADD, SUB), may not
be followed directly by an instruction that implicitly uses the SP, i.e. a POP or RETURN
instruction. To ensure proper operation, an instruction should be inserted that does not use
the stack pointer.
WRONG:
BSET
DP3.13
;
;change direction of P3.13 to output
BSET
P3.5
;
;P3.13 is still input, the rd-mod-wr reads pin P3.13
RIGHT:
BSET
DP3.13
;
;change direction of P3.13 to output
NOP
;any instruction not accessing port 3
BSET
P3.5
;
;P3.13 is now output, the rd-mod-wr reads the P3.13 output latch