Chapter 7I/O PortVII - 32 Ports7.3 Ports7.3.1 Description (Port 1)■ General Port SetupEach bit can be set individually as either an input or output by the port 1 I/O control register (P1DIR). The controlflag of the P1DIR register is set to “1” for output mode and to “0” for input mode.To read input data of a pin, set the control flag of the P1DIR to “0” and read the value of the port 1 input register(P1IN).To output data to a pin, set the control flag of the P1DIR register to “1” and write data to the port 1 output register(P1OUT).Each bit can be set individually if pull-up resistor is added or not, by the port 1 pull-up control register (P1PLU).Set the control flag of the P1PLU register to “1” to add pull-up resistor.■ Special Function Pin SetupP10 to P14 are used as external interrupt pins as well.P16 is used as an I/O pin of timer 17 as well. Each bit can be selected individually as output mode by the port 1output mode register (P1MD). P16 outputs special function data when the control flag of the P1MD is “1”and isused as a general port when it is “0”.P17 is used as a serial 2 output pin as well. It is an output pin for the serial 2 and UART2 transmission data. Whenthe SC2SBOS flag of the serial interface 2 mode register 1 (SC2CTR1) and the P17M flag of the port 1 outputmode register (P1MD) are set to “1”, P17 becomes an output pin for the serial data.