Post Go back to editing

help reading adxl312 (spi 4 wire)

Thread Summary

The user is experiencing issues reading acceleration data from the ADXL312 using a PIC18F4550 microcontroller with PICBasic. The final answer indicates that the user should seek support from the Analog Devices support team, as EngineerZone does not currently provide a community for ADXL312. The accompanying answer suggests visiting the Analog Devices support website for further assistance.
AI Generated Content
hi,

i am having trouble reading acceleration data from adxl312, this  accelerometer can be read/write similar to adxl345.
below is my code, it doesn't work,  no matter how much i shake it i get only 0 reading. i would really  appreciate any help..
i am working with picbasic/pic18f4550

thanks

include "modedefs.bas" DEFINE OSC 48 rx var porta.3 tx var porta.4 data_in var porta.5 data_out var porte.0 CLOCK var porte.1 cs var porte.2 adxl_data_x0 var word adxl_data_x1 var word pause 100 high CS SEROUT tx,T9600,["ADXL 312 Test...",10]     high CLOCK     low cs     shiftout data_out, CLOCK, 2, [%0011000100100000]     high cs      high CLOCK     low cs     shiftout data_out, CLOCK, 2, [%0010111010000000]     high cs              high CLOCK     low cs     shiftout data_out, CLOCK, 2, [%0010111100000000]     high cs     high CLOCK     low cs     shiftout data_out, CLOCK, 2, [%0010110000001010]     high cs     high CLOCK     low cs     shiftout data_out, CLOCK, 2, [%0010110100001000]     high cs     main:     pause 10            high CLOCK     low cs     shiftout data_out, CLOCK, 2, [%10110011]     shiftin data_in, CLOCK, 6, [adxl_data_x1\13]     high CS     high CLOCK     low cs     shiftout data_out, CLOCK, 2, [%10110010]     shiftin data_in, CLOCK, 6, [adxl_data_x0\13]     high CS               SEROUT tx,T9600,["START",10]     SEROUT tx,T9600,[#adxl_data_x0,10]     SEROUT tx,T9600,[#adxl_data_x1,10]     SEROUT tx,T9600,["END",10] goto main

Thread Notes