TOP

What should be noted when switch IO port from output mode to input mode?

1.Steps for input mode switching to output mode:
(1) Initial I/O status, that is assign pre-value to Pn;
(2) Switch to output mode, that is assign "1" to PnM.
2.It can be seen from the basic structure of I/O port: pull-up resistor is invalid when switched to output mode. So PnUR can not be operated.
3.When modify status of the same port with different I/O pin, it is better to use MOV PX, A port command operation,
such as:
MOV A, # XXH
B0MOV PX,A
MOV A,#XXH
B0MOV PXM,A

For more information please refer to AN004: I/O mode switch instructions.