+ Reply to Thread
Results 1 to 4 of 4

Thread: Freescale MMA7455 accelerometer module to SX28

  1. #1

    Default 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

  2. #2

    Default Re: Freescale MMA7455 accelerometer module to SX28

    Post your whole program as an attachment.
    When the going gets weird, the weird turn pro. -- HST

    my site: 1uffakind.com
    create bitmap data tool: 1uffakind.com/robots/povBitMapBuilder.php
    resistor ladder tool: 1uffakind.com/robots/resistorLadder.php
    convert images to ascii art: 1uffakind.com/apptoys/convtoascii/
    MC6808/Hero-1 assembler: 1uffakind.com/apptoys/onlinecompilers/MC6800/

  3. #3

    Default Re: Freescale MMA7455 accelerometer module to SX28

    Here's the code (see attached)...

    It works like this. I hooked up a small speaker to a data pin on my proto board. I set the pin to switch on and off using the Freescale MMA7455 output value as a pause (I'm only using one axis). Therefore, the lower the accelerometer value, the faster the speaker clicks.

    I started with the code Parallax has for the Basic Stamp. This speaker test works fine on the Basic Stamp but all I get on the SX is the speaker clicking on and off at a regular frequency that doesn't change when I rotate the accelerometer.

    Any help would be great.

  4. #4

    Default Re: Freescale MMA7455 accelerometer module to SX28

    I made a few changes that may help -- setting pin dirs explicitly, initing the CS pin, and I'm not sure the address << 1 in the SHIFTIN/SHIFTOUT args will work as expected.

    Also, you need to have the \16 or \12 or however many bits you need to shiftout for the device register address (I didn't check the docs for the device; I'll leave that to you).
    When the going gets weird, the weird turn pro. -- HST

    my site: 1uffakind.com
    create bitmap data tool: 1uffakind.com/robots/povBitMapBuilder.php
    resistor ladder tool: 1uffakind.com/robots/resistorLadder.php
    convert images to ascii art: 1uffakind.com/apptoys/convtoascii/
    MC6808/Hero-1 assembler: 1uffakind.com/apptoys/onlinecompilers/MC6800/

+ Reply to Thread

Similar Threads

  1. [unsolved] PASM & MMA7455 Accelerometer
    By bradharper in forum Propeller 1 Multicore Microcontroller
    Replies: 1
    Last Post: 07-20-2011, 05:32 AM
  2. MMA7455 Accelerometer Z axis reading
    By blewis999 in forum Sensors
    Replies: 0
    Last Post: 12-28-2010, 11:07 PM
  3. Help with MMA7455 3-Axis Accelerometer Module
    By Faddy in forum BASIC Stamp
    Replies: 1
    Last Post: 04-23-2010, 10:18 PM
  4. Replies: 0
    Last Post: 09-12-2009, 06:24 AM
  5. Replies: 1
    Last Post: 03-29-2009, 11:00 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts