Problem with setting I2C address using KDS

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problem with setting I2C address using KDS

Jump to solution
874 Views
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.

Labels (1)
Tags (3)
0 Kudos
1 Solution
864 Views
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.

View solution in original post

2 Replies
865 Views
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.
851 Views
johns_chuang
Contributor III

Hi Bobpaddock

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

0 Kudos