Memsic has a relatively new dual axis accelerometer 6202 with an i2C interface. It is available in single quantities very inexpensively. It is also available on a carrier board from gravitech.us. I have had good luck getting it to work with the BS2p, but have been fighting with making it work with the picaxe 18x.
I attach SDA and SCL to the appropriate pins and pull them up through 4.7k resistors. I power and ground the chip.
The code I am using is:
symbol MXC6202 = %00010000 'checked with part code on chip
i2cslave MXC6202, i2cslow, i2cbyte 'initialize part
pause 100
Main:
readi2c 0, (b0,b1,b2,b3,b4) 'register, MSBx, LSBx, MSBY,LSBY
sertxd (#b0,",",#b1,",",#b2,",",#b3,",",#b4,13,10)
pause 100
goto Main
This doesn't work. (It outputs a series of 255s meaning that the bus is pulled up)
If I try inserting writei2c (0) before each read command, the serial out starts spitting out repetitive noise. (It is not clear if this is necessary from my reading of the data sheet and i2c reference)
Here is a link to the datasheet.
http://gravitech.us/MicroResearch/I2C/I2C-ACC/MXC6202xJ.pdf
Thanks for any help!
I attach SDA and SCL to the appropriate pins and pull them up through 4.7k resistors. I power and ground the chip.
The code I am using is:
symbol MXC6202 = %00010000 'checked with part code on chip
i2cslave MXC6202, i2cslow, i2cbyte 'initialize part
pause 100
Main:
readi2c 0, (b0,b1,b2,b3,b4) 'register, MSBx, LSBx, MSBY,LSBY
sertxd (#b0,",",#b1,",",#b2,",",#b3,",",#b4,13,10)
pause 100
goto Main
This doesn't work. (It outputs a series of 255s meaning that the bus is pulled up)
If I try inserting writei2c (0) before each read command, the serial out starts spitting out repetitive noise. (It is not clear if this is necessary from my reading of the data sheet and i2c reference)
Here is a link to the datasheet.
http://gravitech.us/MicroResearch/I2C/I2C-ACC/MXC6202xJ.pdf
Thanks for any help!