cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

Anyone have any example code for interfacing a 5LP to an Analog Devices ADXL3xx accelerometer using i2c?

   

Im interested in the best way of implementing the write/read operations in which you write a register number and read the content.

0 Likes
2 Replies
JoMe_264151
Expert II

I used a different accellerometer with I2C and it resulted in the sequence of

   

I2C_SendStart()

   

I2C_WriteByte()

   

I2C_SendRestart()

   

I2C_ReadByte(NAK)

   

My device allowed for multiple reads which were done with I2C_ReadByte(ACK) while only the last byte was red with a NAK.

   

Never forget to analyze a returned state for error conditions.

   

 

   

Bob

0 Likes
JoMe_264151
Expert II

Oh, yes, and of course a I2C_SendStop().

   

 

   

Bob

0 Likes