找回密码
 立即注册

微信扫码登录

查看: 93|回复: 2

I2C怎么用

[复制链接]

15

主题

27

回帖

145

积分

注册会员

积分
145
发表于 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

主题

26

回帖

201

积分

中级会员

积分
201
发表于 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.

15

主题

27

回帖

145

积分

注册会员

积分
145
 楼主| 发表于 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-8 04:50 , Processed in 0.079649 second(s), 18 queries .

Powered by Telink 隐私政策

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

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