CPU:富士通16位单片机
(全局变量用来移位的学习)
#define DSPEN IO_PDR3.bit.P32
#define DSPCLK IO_PDR3.bit.P31
#define DSPDIN IO_PDR3.bit.P30
#define EN_DIRE IO_DDR3.bit.D32
#define CLK_DIRE IO_DDR3.bit.D31
#define DIN_DIRE IO_DDR3.bit.D30
//定义一个全局变量用来循环移位
union{
unsigned char byte;
strut{
unsigned char :7;
unsigned char bit7:1;
}bit;
}temp;
void dispcmd(unsigned char data)
{
char i;
temp.byte=data;
DSPEN=0;
for(i=8;i>0;i--)
{
DSPDIN=temp.bit.bit7;
temp.byte<<1;
DSPCKL=0;
DSPCLK=1;
}
DSPEN=1;
}