I have one question about the connection between rcm4100 and a accelerometer sensor (ADXL345).
if you can help me, please tell me, what is the first that i need to do?
how I can to make an a communication using I2C?


Dynamic C includes I2C support (see Lib/Rabbit4000/I2C/I2C_SW.LIB for Rabbit 4000) and some sample programs for interfacing with I2C devices using PD6 and PD7.

If you look through I2C_DEVICES.LIB, you’ll see how to communicate with an EEPROM and DAC. Those should be a good starting point for interfacing to the ADXL345.

I’d also highly recommend getting a logic analyzer to hook up to the I2C pins so you can monitor and decode communications between the devices.

1 Like

yes, i check the lib in (Lib/Rabbit 4000/I2C/I2C SW.LIB for Rabbit 4000) and i saw the example, yesterday i did an a program for rcm4100, but the program not functioning very well. I can see the pulse that this rabbit send for SDA and SCL, but when i hope the answers to the ADXL345 i don’t have nothing. What happened with my software? what need to do now? do you have any examples that can help me?

this is my program for write in the ADXL345 from rcm4100:

i2c_write_char(ACC_ADDRESS); //0x53
i2c_write_char(register); //0x31
i2c_write_char(data); //0x0C

and, this is my program for read in rcm4100 (fr read data from ADXL345)

i2c_startw_tx(); //start
i2c_write_char(ACC_ADDRESS); //write dirección ACC
i2c_write_char(register); //direction of register
i2c_startw_tx(); //start
i2c_write_char(ACC_ADDRESS); //dirección ACC
i2c_read_char(read_string); //read_

In your example code I believe you will need to set the address to either 0xA6 or 0x3A for a write operation and 0xA7 or 0x3B for a read (ACC_ADDRESS | 1).

Which to use depends on the ALT ADDRESS pin.



thank friend, this works for me.


So is everything working for you now? If not, you will need to look at the I2C lines with a logic probe, and compare what the Rabbit sends to what the datasheet of the ADXL345 specifies.

yes, now all is working. I needed to change two jumpers in the rabbit’s schematic diagram, specifically the jumper JP3 and JP4, because these jumpers came made of factory and connected the pin 46 and 47 (rabbit’s processor) with pin LN6 and LN7 and not with the pins PD6 and PD7.

thanks for your help.