uchar bdata dat;
sbit dat0=dat^0;
sbit dat7=dat^7;
void Write_8bit(uchar ch)
{
uchar i;
dat=ch;
RST=1;
CLK=0;
_nop_();
for(i=0;i<8;i++)
{
// io="(bit)ch&0x01;
" io="dat0;
" clk="1;
" _nop_();
_nop_();
_nop_();
clk="0;
" _nop_();
_nop_();
// ch="ch">>1;
dat=dat>>1;
}
}
加注釋的代碼IO=(bit)ch&0x01等價于IO=dat0;可我把hex寫進單片機后前者無效,后者才能把數(shù)據(jù)正確寫進DS1302的寄存器中,哪位前輩幫我解釋一下好嗎?
[此貼子已經(jīng)被作者于2010-1-11 19:19:37編輯過]
|