ADS8598H采集的数据出现了丢失,请问如何解决这种问题?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
/*读取数据*/
uint8_t AD8598_read_data(void)
{
uint32_t count=0;
uint8_t i;
AD8598_reset();
AD8598_start_convstab();
if(ad_state==1) //避免没有AD数据的输出
{
//插入等待,同时转换组装数据
assembly_send_array();
//USART串口通信模式
/*传16进制码*/
for(i=0;i<NUMBER_OF_CHANNEL*3+2;i++)
{
usart_data_transmit(USART0, AD8598_usart_send_8[i]);
while (usart_flag_get(USART0, USART_FLAG_TBE)== RESET);
}
}
//等待BUSY拉低
while(1)
{
if(gpio_input_bit_get(AD8598_BUSY_PORT,AD8598_BUSY_PIN)==RESET)
break;
else
{
count++;
if(count>=50000){
return 1;
}
}
}
for(count=0;count<NUMBER_OF_CHANNEL;count++)
{
AD8598_rd_low();
AD8598_data_true_16[count*2]=gpio_input_port_get(AD8598_DATA_PORT);
AD8598_data_true_16[count*2]=AD8598_data_true_16[count*2]^0x8000; //补码转原码
AD8598_rd_high();
AD8598_rd_low();
AD8598_data_true_16[count*2+1]=gpio_input_port_get(AD8598_DATA_PORT);
AD8598_rd_high();
}
ad_state=1;
return 0;
}
/*读取数据*/ uint8_t AD8598_read_data(void) { uint32_t count=0; uint8_t i; AD8598_reset(); AD8598_start_convstab(); if(ad_state==1) //避免没有AD数据的输出 { //插入等待,同时转换组装数据 assembly_send_array(); //USART串口通信模式 /*传16进制码*/ for(i=0;i<NUMBER_OF_CHANNEL*3+2;i++) { usart_data_transmit(USART0, AD8598_usart_send_8[i]); while (usart_flag_get(USART0, USART_FLAG_TBE)== RESET); } } //等待BUSY拉低 while(1) { if(gpio_input_bit_get(AD8598_BUSY_PORT,AD8598_BUSY_PIN)==RESET) break; else { count++; if(count>=50000){ return 1; } } } for(count=0;count<NUMBER_OF_CHANNEL;count++) { AD8598_rd_low(); AD8598_data_true_16[count*2]=gpio_input_port_get(AD8598_DATA_PORT); AD8598_data_true_16[count*2]=AD8598_data_true_16[count*2]^0x8000; //补码转原码 AD8598_rd_high(); AD8598_rd_low(); AD8598_data_true_16[count*2+1]=gpio_input_port_get(AD8598_DATA_PORT); AD8598_rd_high(); } ad_state=1; return 0; }
关于电路图
1、pin1是否连接至A5V?
2、AGND是否与DGND连接?
3、把STBY和RANGE都接地,会使设备进入Shutdown 模式
4、看您贴的时序图是数据手册7.4.2.2.2 Simultaneous Sampling Two Sets of Input Channels描述的采样模式,看时序图可以知道,CONVSTA 和 CONVSTB 信号必须是单独的控制输入,但是您的原理图中是连接在一起的都由PA8控制