完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
首先要检查硬件连接,开始可以通讯,后来不可以,重点看一下接口有无损坏。另外,要用示波器查看关键管脚的电压是否正常。
|
|
|
|
这是我的程序 u32 spi(u32 data) { u32 Data_recive; u8 temp11,temp22,temp33,temp44; u8 temp1,temp2,temp3,temp4; temp4=data; temp3=data>>8; temp2=data>>16; temp1=data>>24; AD7280A_NCS; _nop_(); //delay >10ns delay_us(10); SPI_Tx(temp1); //delay_us(2); //need longer wait while reading single chip at upper position temp11=SPI_Rx(); SPI_Tx(temp2); //delay_us(2); //need longer wait while reading single chip at upper position temp22=SPI_Rx(); SPI_Tx(temp3); //delay_us(2); //need longer wait while reading single chip at upper position temp33=SPI_Rx(); SPI_Tx(temp4); //delay_us(2); //need longer wait while reading single chip at upper position temp44=SPI_Rx(); delay_us(10); AD7280A_CS; delay_us(3); Data_recive=(temp11<<24)+(temp22<<16)+(temp33<<8)+temp44; printf("%x %x %x %x ",temp11,temp22,temp33,temp44); return Data_recive; } void initad7280_1() { spi(0x01c2b6e2); delay_us(90); AD7280A_NCS; delay_us(15); AD7280A_CS; spi(0x038716ca); } void caiji_1() { u32 temp1,temp2,temp3,temp4,temp5,temp6; u32 temp11,temp22,temp33,temp44,temp55,temp66; spi(0x038011CA); spi(0x01A0131A); delay_us(90);//90us spi(0x03A0546A); AD7280A_CNVST; delay_us(10); //CNVST AD7280A_NCNVST; delay_us(50); AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp1=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp2=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp3=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp4=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp5=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp6=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp11=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp22=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp33=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp44=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp55=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; delay_us(10); //CS AD7280A_NCS; temp66=spi(0xF800030A); delay_us(90);//90us AD7280A_CS; printf("%5.4frn",((float)((temp1>>11)&0x00000fff)/4096)*4+1); printf("%5.4frn",((float)((temp2>>11)&0x00000fff)/4096)*4+1); printf("%5.4frn",((float)((temp3>>11)&0x00000fff)/4096)*4+1); printf("%5.4frn",((float)((temp4>>11)&0x00000fff)/4096)*4+1); printf("%5.4frn",((float)((temp5>>11)&0x00000fff)/4096)*4+1); printf("%5.4frn",((float)((temp6>>11)&0x00000fff)/4096)*4+1); printf("%5.4frn",((float)((temp11>>11)&0x00000fff)/4096)*5); printf("%5.4frn",((float)((temp22>>11)&0x00000fff)/4096)*5); printf("%5.4frn",((float)((temp33>>11)&0x00000fff)/4096)*5); printf("%5.4frn",((float)((temp44>>11)&0x00000fff)/4096)*5); printf("%5.4frn",((float)((temp55>>11)&0x00000fff)/4096)*5); printf("%5.4frn",((float)((temp66>>11)&0x00000fff)/4096)*5); 但是结果如下 1.0000 1.2227 1.0039 1.0000 1.2510 1.4072 2.1570 2.1936 2.1436 2.1362 2.1228 2.1973 电池检测部分的电压值一个都不对 |
|
|
|
|
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
870 浏览 2 评论
给ADUM4223 增加信号驱动15V电压就不正常, 波动很大会被烧是什么情况?
1311 浏览 2 评论
ADP5092 SYS端口为2.09V,但是REG_OUT为0是什么原因?
1907 浏览 1 评论
ad7193差分输入ain1与ain2差是正值时,读到电压与实际值误差小,但为负值值,误差就变的很大
4246 浏览 2 评论
9006 浏览 1 评论
ADC3442采集,分析数据出现有规则毛刺,请问是哪方面的问题啊?
1437浏览 3评论
AD7190状态寄存器一直是0x80,连续转换模式下RDY不拉低
1656浏览 2评论
876浏览 2评论
1631浏览 2评论
给ADUM4223 增加信号驱动15V电压就不正常, 波动很大会被烧是什么情况?
1311浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-29 13:26 , Processed in 1.127290 second(s), Total 85, Slave 68 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号