已回答假定已回答

AD7190BRUZ 多通道切换读取问题

hf_xyz@163.com 在 2016-4-5 詢問的問題
最後回覆由adj於2016-4-7提供

使用的是STM32F103RET单片机

AD7190BRUZ

问下这个芯片,有四个AI输入端,我使用的单极性,采集三路电压信号,请问下如何才能依次读取这三路信号呢?》

我现在只能读取到上电后第一次配置的通道电压,在切换通道需要重启单片机,

void init_adc(void)

{

ADC_WR_8Byte(0x08); //All communications to the part must start with a write operation to the communications register,set next operation as a write to the Mode register

ADC_WR_24Byte(0x0018); //write Mode register /*--select external clock---*/

ADC_WR_8Byte(0x10); //All communications to the part must start with a write operation to the communications register,set next operation as a write to the Configuration register

ADC_WR_24Byte(0x1008);////write Configuration register /*--select AI1--AICOM, unipolar---*/

ADC_WR_8Byte(0x5C); // continuously  read data

// GPIO_ResetBits(GPIOC , GPIO_Pin_1);//din=0

}

// initial ADC , select channel 2void init_adc_v1(void)

{

ADC_WR_8Byte(0x08); //All communications to the part must start with a write operation to the communications register,set next operation as a write to the Mode register

ADC_WR_24Byte(0x0018); //write Mode register /*--select external clock---*/

ADC_WR_8Byte(0x10); //All communications to the part must start with a write operation to the communications register,set next operation as a write to the Configuration register

ADC_WR_24Byte(0x2008);////write Configuration register /*--select AI1--AICOM, unipolar---*/

ADC_WR_8Byte(0x5C); // continuously  read data

// GPIO_ResetBits(GPIOC , GPIO_Pin_1);//din=0

}

// initial ADC , select channel 3

void init_adc_v2(void)

{

ADC_WR_8Byte(0x08); //All communications to the part must start with a write operation to the communications register,set next operation as a write to the Mode register

ADC_WR_24Byte(0x0018); //write Mode register /*--select external clock---*/

ADC_WR_8Byte(0x10); //All communications to the part must start with a write operation to the communications register,set next operation as a write to the Configuration register

ADC_WR_24Byte(0x4008);////write Configuration register /*--select AI1--AICOM, unipolar---*/

ADC_WR_8Byte(0x5C); // continuously read data

// GPIO_ResetBits(GPIOC , GPIO_Pin_1);//din=0

}

附件

結果