ad7793在stm32下的控制程序谁有,千分悬赏。经验证后付费也可以。

ad7793在stm32下的控制程序谁有,千分悬赏。经验证后付费也可以。,第1张

够详细了吧。。。

void AD7793_GPIO_Config(void){GPIO_InitTypeDef GPIO_InitStructure GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING GPIO_Init(GPIOA, &GPIO_InitStructure) GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4 | GPIO_Pin_6 | GPIO_Pin_7 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP GPIO_Init(GPIOA, &GPIO_InitStructure) RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE) AD7793_CS_SET() }void WriteToReg(unsigned char ByteData) {unsigned char temp unsigned char i AD7793_CS_CLR() temp=0x80 for(i=0i<8i++){if((temp &ByteData)==0){AD7793_DIN_CLR() }else{AD7793_DIN_SET() }AD7793_SCLK_CLR() Delay(200) AD7793_SCLK_SET() Delay(200) temp=temp>>1 }AD7793_CS_SET()}void AD7793_Reset(void) //复位AD7793{unsigned int ResetTime ResetTime=32 AD7793_SCLK_SET() AD7793_CS_CLR() AD7793_DIN_SET() while(ResetTime--){WriteToReg(0xff) Delay(100) AD7793_SCLK_CLR() Delay(100) AD7793_SCLK_SET() }AD7793_CS_SET()}unsigned char AD7793_ReadStatusRegister(void) //读状态寄存器{unsigned char j unsigned char temp WriteToReg(0x40) AD7793_DIN_SET() AD7793_CS_CLR() temp=0 AD7793_DOUT_SET()for(j=0j<8j++){AD7793_SCLK_CLR() AD7793_DOUT_SET()if(AD7793_DOUT_GET()==0){temp=temp<<1 }else{temp=temp<<1 temp=temp+0x01 }Delay(200) AD7793_SCLK_SET() Delay(200) }AD7793_CS_SET() return temp}void Ad7793_WriteModeRegister(unsigned char ModeRegisterH,unsigned char ModeRegisterL) //写模式寄存器{WriteToReg(0x08) WriteToReg(ModeRegisterH) WriteToReg(ModeRegisterL)}void Ad7793_WriteConfigRegister(unsigned char ConfigRegisterH,unsigned char ConfigRegisterL) //写配置寄存器{WriteToReg(0x10)WriteToReg(ConfigRegisterH)WriteToReg(ConfigRegisterL)}void Ad7793_WriteIORegister(unsigned char IORegister) //写IO寄存器{WriteToReg(0x28)WriteToReg(IORegister)}long AD7793_ReadDataRegister(void) //读数据寄存器{union long_4uchar AD7793Result unsigned char i,j unsigned char temp temp=AD7793_ReadStatusRegister() while((temp&0x80)==0x80){temp=AD7793_ReadStatusRegister() }WriteToReg(0x58) AD7793_DIN_SET() AD7793_CS_CLR()AD7793_DOUT_SET()for(i=0i<3i++){for(j=0j<8j++){AD7793_SCLK_CLR() AD7793_DOUT_SET()if(AD7793_DOUT_GET()==0){temp=temp<<1 }else{temp=temp<<1 temp=temp+0x01 }Delay(200) AD7793_SCLK_SET() Delay(200) }AD7793Result._4byte._uchar[3-i]=temp }AD7793_CS_SET() AD7793Result._long=AD7793Result._long>>17 return AD7793Result._long}void Init_AD7793(void){AD7793_GPIO_Config() AD7793_Reset() Ad7793_WriteModeRegister(0x00,0x0a) Ad7793_WriteConfigRegister(0x1A,0x10) Ad7793_WriteIORegister(0x03)}

为了测量采集板的精度,找来一个多功能校准仪,输出2mV信号到采集板,采集很不稳定,波动几十mV。

开启辐射光源,用万用表测量辐射表输出信号为1.410mV。用采集板测量,结果基本稳定在1.39-1.40mV,小数点第三位跳动。

项目用来测量太阳辐射表的输出信号(毫伏级),采集芯片为AD7793,24位AD,差分输入。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11825690.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-19
下一篇 2023-05-19

发表评论

登录后才能评论

评论列表(0条)

保存