|
本帖最后由 dontium 于 2015-1-23 11:18 编辑
uint ADC12_Config(unsigned char temp)
{
unsigned char i;
uint num,tmp=0x000;
CS_0;
SCLK_1;
for(i=0;i<8;i++)
{
num=temp & 0x80;
if(num)
DIN_1;
else
DIN_0;
SCLK_0;
temp<<=1;
delay_us();
SCLK_1;
delay_us();
switch(i)
{
case 4:
tmp |= (DOUT<<11); break;
case 5:
tmp |= (DOUT<<10); break;
case 6:
tmp |= (DOUT<<9); break;
case 7:
tmp |= (DOUT<<8); break;
}
}
for(i=0;i<8;i++)
{
tmp |= (DOUT<<(7-i));
SCLK_1;
delay_us();
SCLK_0;
}
CS_1;
return tmp;
}
这样去写驱动程序 出不来啊 求解释
|
|