AnsweredAssumed Answered

ADIS16360 DRIVER HELP

Question asked by ALCENGINEER on Jul 2, 2012
Latest reply on Jul 2, 2012 by NevadaMark

I was hoping that some one could help me with making a driver for the ADIS16360. I am currently getting data, but with a lot of drift. my current set up is as mentioned an adis16360 connected to a microchip 18F45K20 and my compiler is CCS. I am polling for data mostly from XACCL_OUT register and am getting (when not in motion). number between 1 and 5. I am polling at a rate of 5hz. because my numbers are all positive I am always drifting at a proximity 3 mm per cycle. I do have it set up correctly to get get negitve numbers. My code is as follows:

ACCL= spi_xfer(INS, ADDRESS, 16);                                                                      // get SPI INFO

UNREAD= ACCL & 0x8000;                                                                                     // get rid of everything except for the MSB

ERROR=ACCL 7 0x4000;                                                                                         // get rid of everything except for the 15th bit

IF( UNREAD == 0x8000 && ERROR != 0x4000){                                                     // if MSB =1 and 13th bit does not equal one then continue

    ...         

     ACCL =ACCL & 3FFF;                                                                                          // get rid of the last 2 bits

     IF(ACCL >= 0x2000){                                                                                            // IF the 14th bit  is one

          ACCL= ACCL & 0x1FFF;                                                                                  // get rid of the 14th bit

          ACCL = ACCL - 0x2000;}                                                                                 // subtact 8192

FLACCL = ACCL * 3.333;                                                                                          //* by units(mG per sec)

FLACCL = FLACCL * .980665;                                                                                     // convert to mm per sec

ACCLP= ACCLP + (FLACCL * .2);                                                                           //add initail distance to current distance( acceleration times 5hz)

RETURN(ACCLP);

 

IF my math looks right then I thought that it could need to be calibrated.  this part confuses me. to do a precision atuonull command the data sheet states that I need to call the GLOB_CMD register. the register should be 0x3E. and in the example to flip bit [7] I should write 0xBE80??? I also should be able to write 0x3E00 to stat a burst read sequence???

thanks in advance for your thoughts

Andrew

Outcomes