How to set AD inputs ports?

Question:

Regarding AD input ports, can half be set to AD input ports and the other half to general input ports?

Answer:

No, AD input ports and general input ports cannot be used together.
The PORT register reads the pin status in 8-bit units.
Therefore, if the PORT register is read while analog voltage is being applied to an AD input port, the pin being used an AD input port would be read at the same time.
This may result in internal through current.
Therefore, when using as AD input ports, please use all the pins as AD input ports, and when using as general ports, please use all the pins as I/O ports.