3183 views|2 replies

693

Posts

7

Resources
The OP
 

High Energy Collection AD7606 ADCV2.0 What's it like? (Part 2) [Copy link]

        In the last post, I shared with you the hardware and functions of AD7606 ADCV2.0. Then I made a transfer board adjustment program according to the technical documents of AD7606. From not being able to collect data before to being able to collect data in the end, this exploration process was really not easy. After collecting and exporting data, I compared it with the program given by the official seller and found that there was a little error between the data I collected and the data calculated by the formula they used. What I mean is that the formula for calculating voltage in the official routine is to use the collected data ADC_Value/32768*10, that is to say, for example, the microcontroller collects ADC_Value=1 6319,16319/32768*10=4.9801636, but this ADC_Value is collected when I use the DC power supply to output 5.004V, so the error |err|=5.004-4.9801636=0.0238364V, the error is about 23.8364mV, I feel that this error is still relatively large, so I used AD7606 to collect multiple sets of voltage data, the specific data is shown in the table below: (powered by DC power supply)
Voltage (V) 0 0.2040.302 0.401 0.5 1.0
ADC_Value 10 660 981 1304 1625 3257
Voltage (V) 1.51.999 2.501 3.001 3.303 4.003
ADC_Value 4888 6517 8154 9785 10773 13055
Voltage (V) 5.004 6.002 7.002 8.002 9.002 10.003
ADC_Value 163191957522839 26089 29360 32626
We cannot intuitively see the changing pattern of the data through the table, so I use MATLAB simulation software to convert the table into an image, open MATLAB software, I use the 2014 version, and then write the code in the MATLAB command line window
  1. clear clc cftool syms xy From the above figure, we can see that the voltage and ADC_Value have a linear relationship: Vol = 0.0003066*ADC_Value + 0.0008209. After the curve is fitted, I converted it into C language and wrote it into the MCU. [code]#include "delay.h" #include "sys.h" #include "usart.h" #include "led.h" #include "lcd.h" #include "logo.h" #include "key.h" #include "24cxx.h" #include "w25qxx.h" #include "touch.h" #include "modechoose.h" #include "adc.h" #include "freecarscope.h" #include "anoflyscope.h" #include "keyboard.h" #include "fdc2214.h" #include "datapro.h" #include "key.h" #include "AD7606.h" #include "Del.h" int main(void) { double Vol = 0; //voltage char buf[20]; s16 DB_data[8] = {0}; //channel acquisition value storage array u8 temp; //BUSY variable NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //set interrupt priority group 2 delay_init(); //delay function initialization uart_init(115200); //initialize the serial port to 115200 LCD_Init(); //LCD screen initialization LED_Init(); //indicator light initialization// Adc_Init(); //ADC acquisition initialization tp_dev.init(); //touch screen initialization AD7606_Init(); //AD7606 initialization// KeyInit(); //key initialization while(1) { AD7606_startconvst(); //AD7670 starts conversion Delay_ns(1); temp = GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_1); //read BUSY status while((temp == 1)) //When busy is low, the data conversion is complete and data can be read { Delay_ns(10); temp = GPIO_ReadInputDataBit(GPIOE,GPIO_Pin_1); // Read the status of BUSY } AD7606_read_data(DB_data); // Read the data of each channel Vol = (double)(DB_data[0]) * 0.0003066 + 0.0008209; //MATLAB fitting formula sprintf(buf,"vol=%lf",Vol); LCD_ShowString(50,100,200,24,24,(u8 *)"CH1:"); LCD_ShowNum(100,100,DB_data[0],8,24); LCD_ShowString(250,100,200,24,24,(u8 *)buf); // LCD_ShowString(50,200,200,24,24,(u8 *)"CH2:"); // LCD_ShowNum(100,200,DB_data[1],8,24); // // LCD_ShowString(50,300,200,24,24,(u8 *)"CH3:"); // LCD_ShowNum(100,300,DB_data[2],8,24); // // LCD_ShowString(50,400,200,24,24,(u8 *)"CH4:"); // LCD_ShowNum(100,400,DB_data[3],8,24); // // LCD_ShowString(50,500,200,24,24,(u8 *)"CH5:"); // LCD_ShowNum(100,500,DB_data[4],8,24); // // LCD_ShowString(50,600,200,24,24,(u8 *)"CH6:"); // LCD_ShowNum(100,600,DB_data[5],8,24); // // LCD_ShowString(50,700,200,24,24,(u8 *)"CH7:"); // LCD_ShowNum(100,700,DB_data[6],8,24); // // LCD_ShowString(50,800,200,24,24,(u8 *)"CH8:"); // LCD_ShowNum(100,800,DB_data[7],8,24); delay_ms(500); } }
复制代码
The experimental effect is shown in the figure: I set the output voltage to 8.451, and the actual collected voltage is 8.4507176. The error |err| = 8.451-8.4507176 = 0.0002824v = 0.2824mV. It can be seen that the accuracy has been greatly improved.

TIM图片20181005100615.jpg (149.03 KB, downloads: 0)

TIM图片20181005100615.jpg
This post is from Innovation Lab

Latest reply

Excel can do linear fitting   Details Published on 2022-6-17 17:04
 
 

1

Posts

0

Resources
2
 

Hello, I would like to ask if the data obtained by the conversion formula in the official data sheet of AD7606 have errors. I have also encountered a similar problem as yours. The voltage sampled has an error of about 0.03V. I think this error is quite large. I would like to ask if you also need to use curve fitting. Is this error normal or abnormal? What went wrong?

This post is from Innovation Lab
 
 
 

3

Posts

0

Resources
3
 

Excel can do linear fitting

This post is from Innovation Lab
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list