完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我有一个传感器(TLV43D—A1B6),需要一次读取多个寄存器。我不知道如何使用MCC生成的代码和事务请求块来实现这一点。我能够在其他类型的传感器上读取和写入单个寄存器,但这是一个更大的挑战。有人能告诉我怎样才能做到这一点吗?我使用的是PIC16F1619、MPLAB-X和XC8 V1.45编译器,谢谢!
以上来自于百度翻译 以下为原文 I have a sensor (TLV493D-A1B6) that requires multiple registers to be read at one time. I am unsure how to implement this using the MCC generated code and the Transaction Request Blocks. I am able to read and write to single registers on other types of sensors, but this one is a bigger challenge. Can someone point me in the right direction on how to get this done? I am using the PIC16F1619, MPLAB-X and XC8 v1.45 compiler. Thanks in advance! |
|
相关推荐
3个回答
|
|
我不使用MCC,所以这只是猜测。如果你能读一个寄存器,你不能告诉它只读取一个字节吗?如果您继续阅读,芯片将只输出顺序寄存器值。
以上来自于百度翻译 以下为原文 I don't use MCC, so this is just guesswork. If you are able to read a single register, can't you tell it to just read more than one byte? The chip will just keep outputting sequential register values if you keep reading. |
|
|
|
|
|
|
|
Hi,传感器可能有大于一字节的I2C传输协议,只需字节,必须根据实际设备类型的数据表计算实际寄存器的内容传输所需的字节数。McC有2种或3种不同的I2C传输方式,它们有不同的应用接口,无论是基础服务库还是MCC设备库。总之,有一个长度参数来指定您想要的寄存器字节数。阅读:例子:MysIL
以上来自于百度翻译 以下为原文 Hi, Sensor may have registers that are larger than one byte. I2C transfer deal with bytes only, you must count up the number of bytes needed to transfer contents of actual register, according to datasheet for the actual device type. Many device types have possibility to read multiple registers in sequence, in the same transfer. See datasheet for the sensor. MCC have 2 or 3 different ways of doing I2C transfers, that have different application interface, either Foundation Services library, or MCC device library. Anyway, there is a length argument to specify the number of Register Bytes that you want to read: example: static uint8_t data[8]; /* Data array to hold the largest number of register bytes wanted. */ uint8_t length; static I2C1_MESSAGE_STATUS I2C1status; /* Static or global variable to receive status from I2C transfer. */ length = 4; /* Set number of register bytes wanted in this transfer. */ I2C1_MasterRead( data, length, address, &I2C1status); ... Mysil |
|
|
|
只有小组成员才能发言,加入小组>>
5192 浏览 9 评论
2011 浏览 8 评论
1936 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3183 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2238 浏览 5 评论
746浏览 1评论
633浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
517浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
644浏览 0评论
544浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-1 09:33 , Processed in 1.402755 second(s), Total 80, Slave 63 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号