曾经写51时,把位都用sbit界说在头文件,换接口只用改界说就行了,对位操作直接赋值就能够,现在用430改本来的程序都要用|和&一条一条渐渐改,换接口又要改一次,感觉很费事啊,我们有没有好的方法能够很方便地完成而不必一条条渐渐改啊!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#define DS1302_IN P2IN
#define DS1302_OUT P2OUT
#define DS1302_OUT P2OUT
#define DS1302_RST BIT1
#define DS1302_SCLK BIT0
#define DS1302_SDI BIT2 //界说MSP320的端口
#define DS1302_RST_LO DS1302_OUT &= ~DS1302_RST
#define DS1302_RST_HI DS1302_OUT |= DS1302_RST
#define DS1302_SCLK_LO DS1302_OUT &= ~DS1302_SCLK
#define DS1302_SCLK_HI DS1302_OUT |= DS1302_SCLK
#define DS1302_SDI_LO DS1302_OUT &= ~DS1302_SDI
#define DS1302_SDI_HI DS1302_OUT |= DS1302_SDI