Precision electronic scale based on AD7190 4.8KHZ ultra-low sound 24-bit Σ-Δ ADC with built-in PGA

Chip maker ADI.

Download materials, forum discussion website: http://www.analog.com/cn/index.html



One: Without further ado, let’s take a look at the information















Second, the code is as follows:


void AD7190_delay (int len)
{
while(len--);

}

void AD7190_Read(u8 len)
{
u8 ar_i,ar_j,ar_temp;SCLK_HIGH();AD7190_delay(2);CS_OFF();AD7190_delay(2); CS_ON();AD7190_delay(2);if(GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_7)==Bit_RESET){//for(ar_i=len;ar_i>0;ar_i--){ar_temp = 0;for(ar_j=0;ar_j<8;ar_j++){SCLK_LOW();ar_temp <<=1;AD7190_delay(5);if(GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_7)>0){ ar_temp |= 1;}else  {ar_temp |= 0;}SCLK_HIGH();AD7190_delay(5);}ADReadBuf[ar_i-1] = ar_temp;}

































}
CS_OFF(); 
}


void AD7190_Write(u8 len,u8 *buf)
{
u8 aw_i,aw_j,aw_temp;SCLK_HIGH();AD7190_delay(1);CS_OFF();AD7190_delay(1);CS_ON();AD7190_delay(1);for(aw_i=len;aw_i>0;aw_i--){aw_temp=*(buf+aw_i-1);for(aw_j=0;aw_j<8;aw_j++){if(aw_temp&0x80) MOSI_HIGH();else             MOSI_LOW();AD7190_delay(1);SCLK_LOW();AD7190_delay(1);SCLK_HIGH();aw_temp <<= 1;}} CS_OFF();


























}


void AD7190_Reset(void)
{
// u8 buf[3];buf[0]=0xff;buf[1]=0xff;buf[2]=0xff;AD7190_Write(3,buf);AD7190_Write(3,buf);AD7190_Write(3,buf);








}


//void AD7190_Configuration(void)
{
// u8 buf[3]; buf[0] = 0x10; AD7190_Write(1,buf);//Write 0x10 to the communication register, control the next operation is to write the configuration register buf[2] =0x00; buf[1]=0x00; buf[0]=0x00; AD7190_Write(3,buf);//Write the configuration register // while (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_3)==Bit_SET); buf[0]= 0x08; AD7190_Write(1,buf);//Write 0x08 to the communication register, control the next operation to write mode register buf[2]=0x08; buf[1]=0x00; buf[0]=0x00; AD7190_Write(3, buf);//Write mode register // while (GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_3)==Bit_SET); buf[0]=0x5C; AD7190_Write(1,buf);//Write 0x5C to the communication register to control the next operation for read data register }























There is data drift in the personal test, specifically caused by temperature drift, power supply, etc. to be tested.





Welcome to exchange and study!

QQ:905420278

E-mail:[email protected]

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324446643&siteId=291194637