Comment calibrer l'cs5550?

A

amhu

Guest
J'ai terminé le gian DC offset et de calibration, mais je rencontre quelques problèmes.
entrée: 0 ~ 100mV DC
lors de l'entrée> 90mv, l'ADC die.I deviner le gian valeur peut-être trop grand.
mais la valeur proviennent de l'étalonnage automatique.

ceci est mon code:
/************************************************* **********
cette fonction nécessite cs5550 INT pavillon,
à l'aide adreq;
write_byte (), read_type (), write_word (), read_word ();
il peut enregistrer et lire automatiquement la valeur en e2p
type: 1: Ain1 compenser étalonnage
2: étalonnage Ain1 gian
3: Ain2 offset calibration
4: Ain2 gian étalonnage
5: l'étalonnage de compenser les deux Ain1 et Ain2 en même temps
6: calibrer gian deux Ain1 et Ain2 dans le même temps,
valeur de retour: unsigned long
************************************************** **********/
unsigned long d'étalonnage (de type unsigned char)
(Unsigned char tmpa, tmpb, tmpc;
union
(unsigned char non [4];
unsigned int nb [2];
unsigned long x;
temp);
if (type == 2)
(tmpa = xoab;
tmpb = xoc0;
)
else if (type == 4)
(tmpa = yoab;
tmpb = yoc0;
)
temp.nb [0] = read_word (tmpa);
temp.nb [1] = read_word (tmpb);

EE_CS = 0; / /先关闭E2P功能
AD_CLK = 0; / /只有在AD_CLK为低电平时才允许AD_CS发生电平变化
AD_CS = 0;
AD_CS = 1; / / CS拉低使串口初始化
AD_CS = 0;
write_byte (0x80) / / restart cs5550

write_byte (0x4a); / / écriture de N = 1000 (0x0003d1), f = 4Hz
write_byte (0x0) / / N = 400 (0x000187), f = 10Hz
write_byte (0x01) / / N = 2000 (0x0007a1), f = 2Hz
write_byte (0x87) / / 100 ms

write_byte (0x40) / / écrire CONFIG reg
write_byte (0x00) / / ain1 gain = 10
write_byte (0x10) / / int下降沿模式
write_byte (0x13) / /两路的高通滤波器都禁止,减少cpuclk噪声,分频比为3

write_byte (0x78) / / écrire CONTRL
write_byte (0x0) / /
write_byte (0x0) / /
write_byte (0x16) / /

write_byte (0x74) / / écrire bouclier reg
write_byte (0x80) / /只允许转换完成时产生中断
write_byte (0x0) / /
write_byte (0x0) / /

if (type == 1) / / Ain1 compenser étalonnage
(tmpa = 0xC9;
tmpb = 0x02;
)
else if (type == 2) / / Ain1 gian étalonnage
(tmpa = 0xca;
tmpb = 0x04;
tmpc = 0x42;
write_byte (tmpc);
write_byte (temp.no [0]);
write_byte (temp.no [1]);
write_byte (temp.no [2]);
)
else if (type == 3) / / Ain2 compenser étalonnage
(tmpa = 0xd1;
tmpb = 0x06;
)
else if (type == 4) / / Ain2 gian étalonnage
(tmpa = 0xd2;
tmpb = 0x08;
tmpc = 0x46;
write_byte (tmpc);
write_byte (temp.no [0]);
write_byte (temp.no [1]);
write_byte (temp.no [2]);
)
else if (type == 5) / / offset de calibrer les deux Ain1 et Ain2 en même temps
(
)
else if (type == 6) / / calibrer gian Ain1 et Ain2 deux en même temps
(
)
else return (0);
write_byte (tmpa) / /发送校正命令

do / / DRDY等待置位
(write_byte (0x1e);
tmpa = read_byte ();
tmpc = read_byte ();
tmpc = read_byte ();
) while (! (tmpa & 0x80));

/ / While (! Adreq) (;)
/ / Adreq = 0;
write_byte (tmpb); / / lire la valeur reg
temp.no [0] = read_byte ();
temp.no [1] = read_byte ();
temp.no [2] = read_byte ();
write_byte (0x5e); / / DRDY清0
write_byte (0xff);
write_byte (0xff);
write_byte (0xff);
write_byte (0xe8); / / start CA5550 en mode continue
AD_CS = 1; / /禁止读写

 

Welcome to EDABoard.com

Sponsor

Back
Top