完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
你好论坛,我想改变启动后的MTCH6102 I2C地址。重写I2CADDR寄存器(0x43)后,寄存器包含新地址(0x24),尽管当尝试使用新地址与MTCH6102通信时,在该地址上没有识别设备。然而,通信使用默认地址(0x25)工作,尽管I2CADDR寄存器中包含0x24。我包括代码的截图和来自BuBurPATE的输出和彼此相邻的序列。同样,我正在使用的函数RealRealStices()和WrreReGiStices()。为了解释什么是最终传输(布尔函数),请参阅另一个附加的屏幕截图。有人知道可能是什么问题,或者如何正确地改变MTCH6102的I2C地址?//我还包括了一部分描述更改I2C地址的文档的截图。谢谢,祝你有个美好的一天:
以上来自于百度翻译 以下为原文 Hello forum, I want to change the MTCH6102 I2C address after boot. After rewriting the I2CADDR register (0x43), the register contains the new address (0x24), though when trying to communicate with MTCH6102 using the new address, no device is recognised on this address. The communication, however, works using the default address (0x25), even though, the I2CADDR register contains 0x24 in it. I am including a screenshot of the code and the outputs from buspirate and serial next to each other. As well, were are the functions readRegister() and writeRegister() that I am using. For explanation on what endTransmission(boolean) function does, see another attached screenshot. // Read register unsigned char readRegister(int i2c_addr, uint8_t addr_reg) { byte error; Wire.beginTransmission(i2c_addr); Wire.write(addr_reg); // register to read error = Wire.endTransmission(false); Wire.requestFrom(i2c_addr, 1); // read a byte while (Wire.available()) { return Wire.read(); } //Debug the I2C changing address issue Serial.print("Error: "); Serial.println(error); } // Write to register unsigned char writeRegister(uint8_t i2c_addr, uint8_t addr_reg, uint8_t dta) { Wire.beginTransmission(i2c_addr); Wire.write(addr_reg); // register to write Wire.write(dta); Wire.endTransmission(); } Anyone knows what might be the issue or how to correctly change the I2C address of MTCH6102? // I have also included a screenshot of a part of the documentation that describes changing the I2C address. Thanks and have a nice day :) Attached Image(s) |
|
相关推荐
|
|
只有小组成员才能发言,加入小组>>
5204 浏览 9 评论
2016 浏览 8 评论
1942 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3188 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2244 浏览 5 评论
755浏览 1评论
641浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
552浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
654浏览 0评论
554浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-6 03:27 , Processed in 1.484804 second(s), Total 75, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号