Freescale MMA7455 accelerometer module to SX28

I am trying to program an SX28 to read a Freescale MMA7455 (Parallax item code: 28526). The Parallax store has code for the Basic Stamp but I'm having trouble porting the code to the SX28 chip.

(Incidently, I also have the Hitachi H48C module from Parallax. If this is easier to program with the SX, I can switch. Also, I've gotten the Memsic 2125 accel to work but it doesn't provide accurate enough results, and the pulsin duration is too long for my application.)

Anyways, back to the Freescale, the subroutines I'm using for DataOut and DataIn are...
(I can post all of my code if that would be more helpful)

SUB DataOut
Address1 = Address1|%10000000
LOW CSPin 'Pull chip select pin low to start transmission
SHIFTOUT DATAPin, CLKPin, MSBFIRST, Address1<<1 '(Address1|%1000000)<<1 'Select register Address1
SHIFTOUT DATAPin, CLKPin, MSBFIRST, SendData '[SendData] 'Write value to Address1
HIGH CSPin 'End transmission
ENDSUB

SUB DataIn
LOW CSPin 'Pull chip select pin low to start transmission
SHIFTOUT DATAPin, CLKPin, MSBFIRST, Address1<<1 'Select register Address1
SHIFTIN DATAPin, CLKPin, MSBPRE, ReceiveData '[ReceiveData] 'Read value from Address1
HIGH CSPin 'End transmission
ENDSUB
Tagged:

Comments

Sign In or Register to comment.