如果把GPIO的每一位定义成这样的会不会更方便一些,这样就跟大家都熟悉的51很相似了
//P1IN寄存器
#define P10IN P1IN_bit.P0
#define P11IN P1IN_bit.P1
#define P12IN P1IN_bit.P2
#define P13IN P1IN_bit.P3
#define P14IN P1IN_bit.P4
#define P15IN P1IN_bit.P5
#define P16IN P1IN_bit.P6
#define P17IN P1IN_bit.P7
//P1OUT寄存器
#define P10OUT P1OUT_bit.P0
#define P11OUT P1OUT_bit.P1
#define P12OUT P1OUT_bit.P2
#define P13OUT P1OUT_bit.P3
#define P14OUT P1OUT_bit.P4
#define P15OUT P1OUT_bit.P5
#define P16OUT P1OUT_bit.P6
#define P17OUT P1OUT_bit.P7
//P1DIR寄存器
#define P10DIR P1DIR_bit.P0
#define P11DIR P1DIR_bit.P1
#define P12DIR P1DIR_bit.P2
#define P13DIR P1DIR_bit.P3
#define P14DIR P1DIR_bit.P4
#define P15DIR P1DIR_bit.P5
#define P16DIR P1DIR_bit.P6
#define P17DIR P1DIR_bit.P7
//P1IFG寄存器
#define P10IFG P1IFG_bit.P0
#define P11IFG P1IFG_bit.P1
#define P12IFG P1IFG_bit.P2
#define P13IFG P1IFG_bit.P3
#define P14IFG P1IFG_bit.P4
#define P15IFG P1IFG_bit.P5
#define P16IFG P1IFG_bit.P6
#define P17IFG P1IFG_bit.P7
//P1IES寄存器(中断触发边沿选择)
#define P10IES P1IES_bit.P0
#define P11IES P1IES_bit.P1
#define P12IES P1IES_bit.P2
#define P13IES P1IES_bit.P3
#define P14IES P1IES_bit.P4
#define P15IES P1IES_bit.P5
#define P16IES P1IES_bit.P6
#define P17IES P1IES_bit.P7
//P1IE寄存器
#define P10IE P1IE_bit.P0
#define P11IE P1IE_bit.P1
#define P12IE P1IE_bit.P2
#define P13IE P1IE_bit.P3
#define P14IE P1IE_bit.P4
#define P15IE P1IE_bit.P5
#define P16IE P1IE_bit.P6
#define P17IE P1IE_bit.P7
//P1SEL寄存器
#define P10SEL P1SEL_bit.P0
#define P11SEL P1SEL_bit.P1
#define P12SEL P1SEL_bit.P2
#define P13SEL P1SEL_bit.P3
#define P14SEL P1SEL_bit.P4
#define P15SEL P1SEL_bit.P5
#define P16SEL P1SEL_bit.P6
#define P17SEL P1SEL_bit.P7 |