//read from the SDO
void CS5532_Read_Data(void){
unsigned char i,j;
ADCS_L();
delay_us(2);
ADCLK_L();
delay_us(2);//
// data bus
ADDI_L();
// delay_us(2);
// ADDI_H();
for(j=0;j<4;j++){
for(i=0;i<8;i++){
ADCLK_H();
delay_us(2);
Sample_buf[j]<<=1;
if(input(PIN_C4))
Sample_buf[j] |= 0x01; //从SDO读取数据
else
Sample_buf[j] &= 0xfe;
delay_us(2);
ADCLK_L();
delay_us(2);
}
}
}
好的,谢谢大神,我试一试只是中间有屏蔽,我整理了一下,你看对不对
void CS5532_Read_Data(void)
{ unsigned char i,j;
ADCS_L();
delay_us(2);
ADCLK_L();
delay_us(2);// // data bus
ADDI_L(); //
delay_us(2); //
ADDI_H();
for(j=0;j<4;j++)
{
for(i=0;i<8;i++)
{
ADCLK_H();
delay_us(2);
Sample_buf[j]<<=1;
if(input(PIN_C4))
Sample_buf[j] |= 0x01; //从SDO读取数据
else
Sample_buf[j] &= 0xfe;
delay_us(2);
ADCLK_L();
delay_us(2);
}
}
}
回复
我要赚赏金打赏帖 |
|
|---|---|
| 基于ArduinoUNO开发板的AT24C02读写测试被打赏¥16元 | |
| TCS3472S传感器及其色彩检测被打赏¥19元 | |
| 【S32DS】S32K3 RTD7.0.1 HSE 组件配置报错问题解决被打赏¥27元 | |
| 【S32K3XX】MCME 启动 CORE1被打赏¥23元 | |
| AG32VH407下温度大气压传感器及其检测被打赏¥20元 | |
| AG32VH407下光照强度传感器BH1750及其检测被打赏¥22元 | |
| AT32VH407下使用温湿度传感器DHT22进行检测被打赏¥20元 | |
| DIY一个婴儿澡盆温度计被打赏¥34元 | |
| 【FreeRtos】FreeRtos+MPU region 配置规则被打赏¥23元 | |
| 【分享开发笔记,赚取电动螺丝刀】三分钟快速上手驱动墨水屏(ArduinoIDE)被打赏¥28元 | |
我要赚赏金
