#include"TLC2543.H"
unsigned int read_TLC2543(unsigned char CH)
{
unsigned char i;
unsigned int AD_R=0;
TLC2543_CS =0;
TLC2543_CLK =0;
CH<<=4;
for(i=0;i<4;i++)
{
TLC2543_SDI=CH&0x80;
TLC2543_CLK=1;
TLC2543_CLK=0;
CH<<=1;
}
TLC2543_SDI=0;
for(i=0;i<8;i++)
{
TLC2543_CLK=1;
TLC2543_CLK=0;
}
TLC2543_CS =1;
_nop_();
_nop_();
_nop_();
_nop_();
_nop_();
TLC2543_CS =0;
for(i=0;i<12;i++)
{
TLC2543_CLK=1;
AD_R<<=1;
if(TLC2543_SDO)
AD_R|=0x01;
TLC2543_CLK=0;
}
TLC2543_CS =0;
return AD_R;
}
protues仿çå¯ä»¥ç
温馨提示:答案为网友推荐,仅供参考