查看22XXdatesheet,未用IO口的配置方式:
6.2.7 Configuring Unused Port Pins
Unused I/O pins should be configured as I/O function, output direction, and left
unconnected on the PC board, to prevent a floating input and reduce power
consumption. The value of the PxOUT bit is don’t care, since the pin is
unconnected. Alternatively, the integrated pull-up/down resistor can be
enabled by setting the PxREN bit of the unused pin to prevent the floating
input. See chapter System Resets, Interrupts, and Operating Modes for
termination unused pins.