Problem with setting I2C address using KDS

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Problem with setting I2C address using KDS

跳至解决方案
1,864 次查看
johns_chuang
Contributor III

Dear

I am trying to communicate with a temperature IC using the I2C of TRK-KEA8, the slave address of the temperature IC is 0x4C,

but the code generated by Components-DGP_LDD can only send 0x98,

 

I have tried the following three methods but they were all ineffective:

1. Changing the I2C_LLD setting in Components Inspector to 0x4C or 76, did not work.

johns_chuang_1-1673591665132.png

 

2. Adding the SelectSlaveDevice instruction in the program, did not work.

johns_chuang_2-1673591690384.png

 

3. Directly modifying the values inside CI2C1_Init() initialization, did not work.

johns_chuang_3-1673591714196.png

 

Are there any other methods or have I misunderstood or missed anything?

Thank you for your time.

标签 (1)
标记 (3)
0 项奖励
回复
1 解答
1,854 次查看
bobpaddock
Senior Contributor III
I2C puts the read/write bit in the lowest bit, so addresses get shifted to the left. 0x4C * 2 = 0x98.

Some data sheets give the shifted value others give the unshifted value for the device's address. You may really need to enter 0x26 = (0x4C / 2). Always a point of confusion with I2C.

在原帖中查看解决方案

2 回复数
1,855 次查看
bobpaddock
Senior Contributor III
I2C puts the read/write bit in the lowest bit, so addresses get shifted to the left. 0x4C * 2 = 0x98.

Some data sheets give the shifted value others give the unshifted value for the device's address. You may really need to enter 0x26 = (0x4C / 2). Always a point of confusion with I2C.
1,841 次查看
johns_chuang
Contributor III

Hi Bobpaddock

Thank you for the detailed explanation, it is very helpful to me. Thank you.

0 项奖励
回复