我是这样设置的:
void init_io(void)
{
P1DIR = 0XFF;
P1OUT = 0;
P1SEL = 0;
P2DIR = 0XFF;
P2OUT = 0;
P2SEL = 0;
P3DIR = 0XFF;
P3OUT = 0;
P3SEL = 0;
P4DIR = 0XFF;
P4OUT = 0;
P4SEL = 0;
P5DIR = 0XFF;
P5OUT = 0;
P5SEL = 0;
P6DIR = 0XFF;
P6OUT = 0;
P6SEL = 0;
P7DIR=0XFF;
P6OUT=0;
P7SEL = 0;
}