PIC16F88 I2C Accelerometer Help


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: PIC16F88 I2C Accelerometer Help

    Perhaps this will help.

    Looking at the MMA7455 datasheet the I2C Device address is "$1D"
    Also to communicate using I2C with the MMA7455 you need to make sure that MMA7455's CS pin is pulled high.

    You should not have to issue a write then a read.
    I2CRead does this for you.

    With PBP Pro, to issue a PBP I2CRead command here is the syntax:
    I2CREAD DataPin, ClockPin, Control,{Address,}[Var{,Var...}]{,Label}
    "Control" is the MMA7455 I2C Slave Address "$1D"
    "Address" is the MMA7455 Register address you want to read, in this case "$07" for "YOUT8".
    "Var" will be a single Byte variable because you are only reading a single byte from the MMA7455.

    So something like this.

    yout var byte 'Holds the value read from the MMA7455 YOUT8 register
    addr var byte 'Holds register address

    addr = $07 'Assign $07 to access the MMA7455's YOUT8 register

    I2CREAD DPIN1, CPIN1, $1D, addr, [yout]
    Regards,
    TABSoft

  2. #2
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: PIC16F88 I2C Accelerometer Help

    After reading a couple other forums, the MMA7455L slave address of $1D is a 7bit address so you need to left shift $1D 1 bit. This makes the address $3A. ($1D << 1 = $3A).
    In an 8bit I2C address the upper 7bits is the device address <7:1> and the LSB <0> is the R/W bit.


    So in binary:
    $1D = %0001 1101 (7bit address)
    $3A = %0011 1010 (7bit address + R/W bit)

    The I2CREAD statement should look like this.
    addr var byte
    yout var byte

    addr $07

    I2CREAD DPIN1, CPIN1, $3A, addr, [yout]

    Hopefully this will work for you.
    Regards,
    TABSoft

Similar Threads

  1. I2C MMA8452 Accelerometer
    By emf985 in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 15th January 2015, 17:28
  2. Accelerometer reading
    By joseph Degorio in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th February 2011, 11:43
  3. accelerometer question
    By griffin in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 27th February 2009, 21:00
  4. Pic16f88-I2c-Interrupt PORTB...
    By robert0 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 23rd September 2007, 03:38
  5. PIC16F88, Bootloader & I2C Memory
    By digilord in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th December 2005, 15:36

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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