plasmaninjaa
Member
Hi, I have an adxl345 accelerometer breakout board from sparkfun.
I have it working with my 14m2 chip.
Here is my code:
however now i need to get it working with a 20x2 chip.
I am using the exact same code, and I get 255 for all the values (b2-b6) except b1 is always 167.
The SDO pin is connected to ground, CS pin is connected to VCC
SCL is connected to b.7, SDA is connected to b.5 both are pulled high by 10k resistors
I can post pictures of the circuit if i need to but I think the problem is most likely in the code.
I have it working with my 14m2 chip.
Here is my code:
Code:
setfreq m32
HI2CSETUP I2CMASTER, 0xA6, i2cfast_32, i2cbyte
HI2COUT 0x31,(0x01) 'Put the ADXL345 into +/- 4G range
HI2COUT 0x2D,(0x08) 'Put the ADXL345 into Measurement Mode
main:
HI2CIN 0x32,(b1,b2,b3,b4,b5,b6) 'read x1,x2,y1,y2,z1,z2 values
low b.5
debug
goto main
I am using the exact same code, and I get 255 for all the values (b2-b6) except b1 is always 167.
The SDO pin is connected to ground, CS pin is connected to VCC
SCL is connected to b.7, SDA is connected to b.5 both are pulled high by 10k resistors
I can post pictures of the circuit if i need to but I think the problem is most likely in the code.