完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,大家好,
我有一些问题,使用ADC和输出的结果在I2C使用CY8CKIT-042-BLE,将非常感谢您的帮助,请! 我试图发送12位ADC输出超过I2C,并设立了一个6电阻分压器,以帮助我了解不同产生的输出相比,实际电压水平。 我正在使用: VREF=VDDA/2 无符号微分模式 VNEG外部设置为VDDA/2 当我使用ADC中的另一种分辨率并将其设置为8比特时,得到Vpos预期的输出,因为它从0变为VDDA(3.3V),即0x00—0xFF。 但是,当我把它改回到12位时,我得到以下输出: 3.3V 0x00 2.75伏0x00 6C 2.2V 0x00 C0 1.65伏0x00 1.1V 0x00 0.55 V 0x00 C3 0V 0x00 对我来说,看起来最重要的4位丢失了。 在我的代码中,我使用位移位代码来访问两个字节: I2CBUF〔1〕=(ADCVAL和GT;GT;8)&0XFF;/ /第一字节 I2CBUF〔2〕=ADCVAL和AMP;0xFF;/ /第二字节 作为一个测试,如果我只移位4位,那么我输出一个位4-7的拷贝,这是有意义的。 我很可能犯了一个简单的错误,所以如果有人能提出这个错误的原因和/或让我澄清或检查的话,我将非常感激。 多谢, 丰富的 以上来自于百度翻译 以下为原文 Hi all, I am having some problems with using the ADC and outputting the result over I2C using CY8CKIT-042-BLE and would very much appreciate your help please! I am trying to send 12-bit ADC output over I2C and have set up a 6-resistor potential divider to help me understand the different generated output compared to the actual voltage levels. I am using: Vref = VDDA/2 Unsigned differential mode Vneg is externally set to VDDA/2 When I use the alternative resolution in the ADC and set this to 8-bit I get the output that I would expect as Vpos is changed from 0 to VDDA (3.3V), that is 0x00-0xFF. However, when I change it back to 12-bit I get the following output: 3.3V 0x00FF 2.75V 0x006C 2.2V 0x00C0 1.65V 0x0016 1.1V 0x0069 0.55V 0x00C3 0V 0x0011 To me, it looks like the most significant 4-bits are missing. In my code I am using the bit-shifting code to access the two bytes: i2cbuf[1] = (adcVal >> 8) & 0xFF; // First byte i2cbuf[2] = adcVal & 0xFF; // Second byte As a test, if I only bit-shift 4 bits then I output a copy of bits 4-7 which makes sense. I am most likely making a simple mistake so I would be very grateful if someone could suggest reasons for this error and/or things for me to clarify/check to get to the bottom of this. Many thanks, Rich |
|
相关推荐
4个回答
|
|
难道这不是I2CBUF(0)和(1),分别吗?
以上来自于百度翻译 以下为原文 Shouldn't this be i2cbuf[0] and [1], respective? |
|
|
|
我有其他东西进入I2CBUF(0)。 6月2017日下午8点35分,“USER7978863”&社区经理@ CyPress .com & GT; 以上来自于百度翻译 以下为原文 I have something else going into i2cbuf[0]. On 6 Nov 2017 8:35 pm, "user_78878863" <community-manager@cypress.com> |
|
|
|
minwayson 发表于 2018-12-10 18:14 所以也许你应该上传你的完整的项目(或者一个最小的显示行为),连同一个示波器/逻辑分析仪的I2C输出的照片(这样我们就可以看到什么通过线发送)。 或者:在I2C发送之前设置断点并验证缓冲区应该是什么(或者将其写入串行端口并与PC进行检查)。 以上来自于百度翻译 以下为原文 So maybe you should upload your complete project (or a minimal one showing the behaviour), together with a oscilloscope / logic analyzer shot of the I2C output (so we can see what gets send over the wires). Alternatively: set a breakpoint just before the I2C send and verify that the buffer what it should be (or write it to the serial port and check with the PC). |
|
|
|
lxhzx 发表于 2018-12-10 18:28 嗨,谢谢你的建议。我使用了调试工具(第一次) ME)并意识到我已经声明了变量来保持ADC输出。 8位而不是16位,所以我看不出最重要的。 位。再次感谢您的建议。 最美好的祝福, 理查德 2017年11月6日21时28分,USERY7878863/LT;社区经理@ CyPress .com & GT; 以上来自于百度翻译 以下为原文 Hi, thanks for the suggestions. I used the debugging tool (first time for me) and realised that I'd declared the variable to hold the ADC output to be 8-bit rather than 16-bit hence I wasn't seeing the most significant bits. Thank you once again for the suggestions. Best wishes, Richard On 6 November 2017 at 21:28, user_78878863 <community-manager@cypress.com> |
|
|
|
只有小组成员才能发言,加入小组>>
716个成员聚集在这个小组
加入小组1901 浏览 1 评论
1652 浏览 1 评论
3405 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
1568 浏览 6 评论
1380 浏览 1 评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
188浏览 2评论
184浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
323浏览 2评论
352浏览 1评论
63浏览 1评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-25 02:19 , Processed in 0.512669 second(s), Total 46, Slave 40 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号