找回密码
 立即注册

微信扫码登录

查看: 172|回复: 3

I2C怎么用

[复制链接]

18

主题

40

回帖

190

积分

荣耀黄金

积分
190
发表于 2024-11-27 09:51:26 | 显示全部楼层 |阅读模式
drv_i2c_write_series(I2C_SLAVE_ID, I2C_SLAVE_ADDR, I2C_SLAVE_ADDR_LEN, tx_data, 1);

        WaitMs(10);  // 等待测量完成

        drv_i2c_read_series(I2C_SLAVE_ID, I2C_SLAVE_ADDR, I2C_SLAVE_ADDR_LEN,data,6);
关于这两个函数 里面的各个参数是什么呢,特别是这个I2C_SLAVE_ID,它支持挂多少设备嘛?

11

主题

31

回帖

219

积分

华贵铂金

积分
219
发表于 2024-11-27 11:47:08 | 显示全部楼层
As you know, you can have multiple devices on the I2C bus. So how would you identify the device that you want to read/write data to? That's why you need to define I2C_SLAVE_ID. You will find it in your device datasheet. The same with I2C_SLAVE_ADDR - what address are you going to write data to? Or read data from? You decide that - again looking in your device datasheet.
Hope that it helps.

18

主题

40

回帖

190

积分

荣耀黄金

积分
190
 楼主| 发表于 2024-11-27 11:52:10 | 显示全部楼层
wes58 发表于 2024-11-27 11:47
As you know, you can have multiple devices on the I2C bus. So how would you identify the device that ...

hi,
Thank you,I've already solved the problem
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Telink forum ( 沪ICP备17008231号-1 )

GMT+8, 2024-12-22 01:56 , Processed in 0.084139 second(s), 22 queries .

Powered by Telink 隐私政策

泰凌微电子版权所有 © 。保留所有权利。 2024

快速回复 返回顶部 返回列表