Post Go back to editing

精密转换器 AD5593R

您好:

        AD5593R芯片,将IO口配置为ADC模式,

void AD5593R_Init(void)
{
// 启用Vref
I2C_Start();
I2C_SendDAdr(0x20);
I2C_SendDat(0x0B);
I2C_SendDat(0x02);
I2C_SendDat(0x00);
I2C_stop();

// 2 * Vref
I2C_Start();
I2C_SendDAdr(0x20);
I2C_SendDat(0x03);
I2C_SendDat(0x01); // 0x01
I2C_SendDat(0x30);
I2C_stop();
}

void AD5593R_ADC_Init(unsigned char IO)
{
I2C_Start();
I2C_SendDAdr(0x20);
I2C_SendDat(0x04);
I2C_SendDat(0x00);
I2C_SendDat(IO);
I2C_stop();
}

下面是读取

unsigned short AD5593R_ADC_Read(unsigned char IO)
{
TEMP = 0;

I2C_Start();
I2C_SendDAdr(0x20);
I2C_SendDat(0x02);
I2C_SendDat(0x02);
I2C_SendDat(IO);
I2C_stop();

I2C_Start();
I2C_SendDAdr(0x20);
I2C_SendDat(0x40 | IO);
// I2C_stop();

// delay1(20);
I2C_Start();
I2C_SendDAdr(0x21);
// delay1(20);
TEMP1 = I2C_ReadDat();
TEMP2 = I2C_ReadDat();
I2C_stop();
TEMP = TEMP1 & 0x0F;
TEMP = (TEMP << 8) | TEMP2;

return TEMP;
}

下面是读取的数据记录

输出AD 输出电压 读取AD 读取电压
0 0 130 0.15873 0.15873
100 0.1221 219 0.267399 0.145299
200 0.2442 170 0.20757 -0.03663
300 0.3663 403 0.492063 0.125763
400 0.4884 492 0.600733 0.112332
500 0.610501 483 0.589744 -0.02076
600 0.732601 692 0.844933 0.112332
700 0.854701 678 0.827839 -0.02686
800 0.976801 912 1.113553 0.136752
900 1.098901 1004 1.225885 0.126984
1000 1.221001 973 1.188034 -0.03297
1100 1.343101 1205 1.471306 0.128205
1200 1.465201 1169 1.42735 -0.03785
1300 1.587302 1260 1.538462 -0.04884
1400 1.709402 1503 1.835165 0.125763
1500 1.831502 1466 1.789988 -0.04151
1600 1.953602 1706 2.083028 0.129426
1700 2.075702 1683 2.054945 -0.02076
1800 2.197802 1765 2.155067 -0.04274
1900 2.319902 2002 2.444444 0.124542
2000 2.442002 1970 2.405372 -0.03663
2100 2.564103 2195 2.680098 0.115995
2200 2.686203 2288 2.793651 0.107448
2300 2.808303 2267 2.76801 -0.04029
2400 2.930403 2503 3.056166 0.125763
2500 3.052503 2468 3.013431 -0.03907
2600 3.174603 2707 3.30525 0.130647
2700 3.296703 2790 3.406593 0.10989
2800 3.418803 2789 3.405372 -0.01343
2900 3.540904 2997 3.659341 0.118437
3000 3.663004 2966 3.62149 -0.04151
3100 3.785104 3214 3.924298 0.139194
0

可以看到差值很大,请问这是什么问题?

谢谢!