void P0 (unsigned char dat)
{
/* unsigned char ax[8];
unsigned char i=0;
for(i=0;i<8;i++)
{
if(dat&(1<<i))
ax[i] = 1;
else
ax[i] = 0;
}
GpioDataRegs.GPBDAT.bit.GPIO39 = ax[0];
GpioDataRegs.GPADAT.bit.GPIO30 = ax[1];
GpioDataRegs.GPADAT.bit.GPIO1 = ax[2];
GpioDataRegs.GPADAT.bit.GPIO3 = ax[3];
GpioDataRegs.GPBDAT.bit.GPIO49 = ax[4];
GpioDataRegs.GPBDAT.bit.GPIO51 = ax[5];
GpioDataRegs.GPCDAT.bit.GPIO71 = ax[6];
GpioDataRegs.GPCDAT.bit.GPIO73 = ax[7];
*/
GpioDataRegs.GPBDAT.bit.GPIO39 = dat&0x01;
GpioDataRegs.GPADAT.bit.GPIO30 = dat&0x02;
GpioDataRegs.GPADAT.bit.GPIO1 = dat&0x04;
GpioDataRegs.GPADAT.bit.GPIO3 = dat&0x08;
GpioDataRegs.GPBDAT.bit.GPIO49 = dat&0x10;
GpioDataRegs.GPBDAT.bit.GPIO51 = dat&0x20;
GpioDataRegs.GPCDAT.bit.GPIO71 = dat&0x40;
GpioDataRegs.GPCDAT.bit.GPIO73 = dat&0x80;
}
我用这个子函数想实现任意8个IO口实现8位数据并行处理,但是调试结果是错误的。单看程序语句,并没有错误,编译也没有检测出错误,但是结果不行。
|