CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

SPI Accelerometer (Freescale MMA7455L) and 16F886
Goto page 1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
starbuck



Joined: 21 Jan 2009
Posts: 6

View user's profile Send private message

SPI Accelerometer (Freescale MMA7455L) and 16F886
PostPosted: Thu Jan 29, 2009 4:10 pm     Reply with quote

I am in the process of interfacing a Freeescale MMA7455L Three axis Digital Output Accelerometer to a PIC16F886. I am using the accelerometers SPI interface and the HW SPI Master of the PIC. I am having a problem reading data from the accelerometer. The accelerometer SDO line (MISO) stays low all the time. I have looked at the /CS, MOSI, and CK signals with a scope and they appear to be of the correct polarity and timing. I believe that I am sending the correct register and (R/W) bits to the device. Does anyone have experience with this device?

Note:
1) I am using CCS PCM version 4.085.
2) When I tried to use "#use spi( MASTER, MODE=0, MSB_FIRST, BITS=8, BAUD=5000, FORCE_HW )" to setup the spi port the CS had the wrong polarity for this device (CS = low), the CK and Data signals were out of phase and timing was not correct.
3) When I used " setup_spi(SPI_MASTER | SPI_L_TO_H | SPI_XMIT_L_TO_H | SPI_CLK_DIV_64);" to setup the SPI port the signals were correct.

Here is my source code:

Code:
// Test code for PIC16F886 connected to Freescale MMA745xL 3-axis Accelerometer
// Compiler CCS PCM version 4.085

#include <16F886.h>
#case
#device ICD = TRUE
#device *=16 ADC=8
#use delay ( clock = 20000000, restart_wdt )

//#use fast_io(a)
//#use fast_io(b)
//#use fast_io(c)

#fuses HS,WDT,NOPROTECT,BROWNOUT,PUT,NOLVP,NOCPD,NOWRT,NOCPD,NOIESO,NOFCMEN

// NOTE: THE #use SPI configuration below generated the wrong clock phase and the clock cycles wer not
//   cooincidient with the data being clocked out on RC5 SDO.
//#use spi( MASTER, MODE=0, MSB_FIRST, BITS=8, BAUD=5000, FORCE_HW )

#zero_ram

int AccelX = 0, AccelY = 0, AccelZ = 0;
int   Accel_Data = 0;
int   Accel_Mode = 0;

// PORTS /////////////////////////////////////////////////////////////////
// PORTA 0b00000011 0x03
#define ULPWU_Cap   PIN_A0   // PORT A0, pin 2, Ultra Low-Power Wake-Up Cap (Input)
#define Batt_Mon   PIN_A1   // PORT A1, pin 3, Batt V Mon Analog (Input)
#define Mon_LED      PIN_A2   // PORT A2, pin 4, Monitor LED (Output)
#define Servo_PWR   PIN_A5   // PORT A5, pin 5, Servo Power Enable (Output)
#define Servo_PWM   PIN_A4   // PORT A4, pin 6, Servo PWM (Output)
#define Bat_Mn_Ctrl   PIN_A5   // PORT A5, pin 7, Battery Monitor Control (Output)

// PORTB 0b00110111 0x37
#define Acc_Int1   PIN_B0   // PORT B0, pin 21, Accelerometer Interrupt 1 (Input)
#define Rel_Pos_2   PIN_B1   // PORT B1, pin 22, Release Position Switch 2 (Input)
#define Rel_Pos_1   PIN_B2   // PORT B2, pin 23, Release Position Switch 1 (Input)
#define ICD_PGM      PIN_B3   // PORT B3, pin 24, ICD RB3 Line
#define Acc_Int2   PIN_B4   // PORT B4, pin 25, Accelerometer Interrupt 2 (Input)
#define ARM_SW      PIN_B5   // PORT B5, pin 26, Arming Pull Away Switch (Input)
#define ICD_PGC     PIN_B6   // PORT B6, pin 27, ICD RB6 Line
#define ICD_PGD      PIN_B7   // PORT B7, pin 28, ICD RB7 Line

// PORTC 0b00010100 0x14
#define Sonar_Trig   PIN_C0   // PORT C0, pin 11, Sonar Strobe Pulse (Output)
#define Acc_CS      PIN_C1   // PORT C1, pin 12, Accelerometer /CS (pin7 of MMA745xL)(Output)
#define Sonar_PW   PIN_C2   // PORT C2, pin 13, Sonar Pulse Width (Input)
#define Acc_SCL      PIN_C3   // PORT C3, pin 14, Accel (SPSCK) Serial Clock Out(SCL) (pin14 of MMA745xL)(Output)
#define Acc_MISO   PIN_C4   // PORT C4, pin 15, Accel MasterInSlaveOut (MISO)(SDI) (pin12 of MMA745xL)(Input)
#define Acc_MOSI   PIN_C5   // PORT C5, pin 16, Accel MasterOutSlaveIn (MOSI)(SDO) (pin13 of MMA745xL)(Output)
#define UNUSED_C6   PIN_C6   // PORT C6, pin 17, UNUSED
#define UNUSED_C7   PIN_C7   // PORT C7, pin 18, UNUSED

#define While_The_Sky_Is_Blue_And_The_Grass_Is_Green TRUE
#define HIGH   1
#define LOW      0

// Accelerometer SPI
// Freescale MMA7455L Accelerometer Defines
// api
#define XOUTL      0x00   // 10 bits output value X LSB
#define XOUTH      0x01   // 10 bits output value X MSB
#define YOUTL      0x02   // 10 bits output value Y LSB
#define YOUTH      0x03   // 10 bits output value Y MSB
#define ZOUTL      0x04   // 10 bits output value Z LSB
#define ZOUTH      0x05   // 10 bits output value Z MSB
#define   XOUT8      0x06   // 8 bits output value X
#define   YOUT8      0x07   // 8 bits output value Y
#define   ZOUT8      0x08   // 8 bits output value Z
#define ASTATUS      0x09   // Status registers
#define   DETSRC      0x0A   // Detection source registers
#define   TOUT      0x0B   // Temperture out value
#define   RES_0C      0x0C   // Reserved 0x0C
#define   I2CAD      0x0D   // I2C device address
#define   USRINF      0x0E   // User information
#define   WHOAMI      0x0F   // Who am I value
#define   XOFFL      0x10   // Offset drift x value (LSB)
#define   XOFFH      0x11   // Offset drift x value (MSB)
#define   YOFFL      0x12   // Offset drift y value (LSB)
#define   YOFFH      0x13   // Offset drift y value (MSB)
#define   ZOFFL      0x14   // Offset drift z value (LSB)
#define   ZOFFH      0x15   // Offset drift z value (MSB)
#define   MCTL      0x16   // Mode control
#define   INTRST      0x17   // Interrupt latch reset
#define CTL1      0x18   // Control 1
#define CTL2      0x19   // Control 2
#define   LDTH      0x1A   // Level detection threshold limit value
#define PDTH      0x1B   // Pulse detection limit value
#define   PW         0x1C   // Pulse duration value
#define   LT         0x1D   // Latency time value
#define   TW         0x1E   // Time windoe 2nd Pulse value.
#define   RES_1F      0x1F   // Reserved 0x1F

/************************ Function Prototypes ************************/
void initialize(void);

/**********************************************************************/

/************************* INITIALIZE *************************/
// Setup on-chip peripherals and i/o
void initialize(void) {

   set_tris_a(0x03);   // PortsA1 and A2 are a/d input, rest are digital outputs
   set_tris_b(0xFF);   // All B ports are inputs
   set_tris_c(0x14);   // C2 and C4 are Inputs, other pins are outputs
   port_b_pullups(TRUE);

   setup_spi(SPI_MASTER | SPI_L_TO_H | SPI_XMIT_L_TO_H | SPI_CLK_DIV_64);

   output_high(Acc_CS);         // Deselect the accelerometer
   output_low(Acc_SCL);
   output_low(Acc_MOSI);

   output_high(Mon_LED);   // Turn the Monitor LED ON

   restart_wdt();
} /* END void initialize (void) { */


/************************* MAIN *************************/
void main() {
   initialize();
   
   delay_ms(50);   // Power up delay to allow stabilization

   while(While_The_Sky_Is_Blue_And_The_Grass_Is_Green) {

      output_low(Acc_CS);            // Select the accelerometer
      spi_write((0x16<<1) | 0x80);   // $16 Write to Mode Control Register
      spi_write(0x05);            // Make sure that we are in 4 wire SPI Mode(D5),
                     //   using 2 G Range(D2&3(, and turned on(D0&1)
      output_high(Acc_CS);         // Deselect the accelerometer

      delay_us(10);

//      output_low(Acc_CS);            // Select the accelerometer
//      spi_write( (0x0D<<1) | 0x80 );   // $0D Write to I2C Device Address Register
//      spi_write( 0x9D );            // Disable I2C, keep address the same as default
//      output_high(Acc_CS);         // Deselect the accelerometer
//
//      delay_us(10);

      output_low(Acc_CS);            // Select the accelerometer
      spi_write((0x16<<1) & 0x7f);   // $16 Read Mode Control Register
      Accel_Mode = spi_read(0);      // $16 Read Mode Control Register
      output_high(Acc_CS);         // Deselect the accelerometer

      delay_us(80);               // Long Interval for scope triggering (FD)

      restart_wdt();

   } /* END while(While_The_Sky_Is_Blue_And_The_Grass_Is_Green) */
} /* END main */
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Jan 29, 2009 7:32 pm     Reply with quote

I looked at the Freescale appnote, AN3468, and I made the test program
shown below. I also made it a lot more simple:

1. Don't use Fast i/o. It's not needed. Let the compiler set the TRIS.
2. Don't use the Watchdog. It's not needed in the initial test program.
3. Don't use the debugger. Display the output with RS-232 on a terminal
window.
4. Don't use inline code. Make the register r/w code into routines
which can be called (just like the appnote).
5. Follow all delay requirements. Add additional delay time for safety.
6. Use SPI defines, rather than CCS constants. The setup_spi()
statement then becomes self-documenting with respect to the mode.
7. The maximum SCLK frequency is 8 MHz for 3.3v operation of the
Freescale chip, so I used a clock divisor of 16, which gives 1.25 MHz.
I didn't use div64 because that seems excessive.

I didn't use defines for the register addresses or data, because at this
point I just wanted to follow the appnote closely.
Code:

#include <16F886.H>
#fuses HS, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock=20000000)
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, ERRORS)

#define ACC_CS  PIN_C1

// SPI modes
#define SPI_MODE_0  (SPI_L_TO_H | SPI_XMIT_L_TO_H)
#define SPI_MODE_1  (SPI_L_TO_H)
#define SPI_MODE_2  (SPI_H_TO_L)
#define SPI_MODE_3  (SPI_H_TO_L | SPI_XMIT_L_TO_H)

//----------------------------------
void Acc_Write_Register(int8 reg, int8 data)
{
output_low(ACC_CS);
spi_write(((reg & 0x3F) << 1) | 0x80);
spi_write(data);
output_high(ACC_CS);
}

//---------------------------------
int8 Acc_Read_Register(int8 reg)
{
int8 data;

output_low(ACC_CS);
spi_write((reg & 0x3F) << 1);
data = spi_read(0);
output_high(ACC_CS);

return(data);
}

//===============================
void main()
{
int8 result;
int8 Xdata, Ydata, Zdata;

output_high(ACC_CS);

delay_ms(10);   // Minimum 1 ms required after power-up.

setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_16);  // 1.25 MHz sclk

Acc_Write_Register(0x16, 0x05);
delay_ms(30);  // Minimum 20 ms required after exiting standby

// Make sure we read back 0x05 from the Control register.
result = Acc_Read_Register(0x16);
printf("Control register = %X \n\r", result);

while(1)
  { 
   Xdata = Acc_Read_Register(0x06); //Read X,Y,Z outputs from Sensor
   Ydata = Acc_Read_Register(0x07);
   Zdata = Acc_Read_Register(0x08);
   delay_ms(500);
   printf("XYZ:  %U, %U, %U \n\r", Xdata, Ydata, Zdata);
  }


}
starbuck



Joined: 21 Jan 2009
Posts: 6

View user's profile Send private message

Results of revised code
PostPosted: Thu Jan 29, 2009 8:17 pm     Reply with quote

PCM Programmer,

I appreciate your insights into streamlining the code for debugging and FD as well as your taking the time to look at the device data sheet to make sure that I did not miss something important in the interface spec.

I tried your code on the hardware that I have here, incorporating your suggestion to use RS-232. That said the hardware, running your code, still is not outputting the MISO signal. I am beginning to think that I may have a bad accelerometer. I have additional devices on order and will replace the accelerometer once it arrives.
wwwglro



Joined: 03 Sep 2009
Posts: 17

View user's profile Send private message

PostPosted: Tue Aug 31, 2010 6:39 am     Reply with quote

Can you post the schematics?
Thank you
wwwglro



Joined: 03 Sep 2009
Posts: 17

View user's profile Send private message

PostPosted: Mon Oct 18, 2010 1:16 pm     Reply with quote

How can I use this accelerometer for g force aplications?
Thanks
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 8:42 am     Reply with quote

Hi all!

I am interfacing 3 accelerometers in SPI mode. I am having some problems, but i will test the code from PCM Programmer and check if it works here. Right now i am obtaining 0 for all axis
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 3:28 pm     Reply with quote

Hello.

Now i was trying the code from PCM Programmer, but i have no results.

I changed a little bit but the result is around the same:
Code:

while(1)
     {
      result = Acc_Read_Register(0x16);
      Xdata = Acc_Read_Register(0x06); //Read X,Y,Z outputs from Sensor
      Ydata = Acc_Read_Register(0x07);
      Zdata = Acc_Read_Register(0x08);
      delay_ms(500);
      output_toggle(LED1);
      printf("CTRL= %X, XYZ= %X, %X, %X \n\r", result, Xdata, Ydata, Zdata);
     }


In the terminal window i obtain:
Code:
* * * * * * * * * * COM Port Opened * * * * * * * * * *

Data received: CTRL= 3F, XYZ= 1F, 3F, 3F
Data received: CTRL= 3F, XYZ= 3F, 3F, 1F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 3F, XYZ= 3F, 3F, 3F
Data received: CTRL= 3F, XYZ= 3F, 3F, 1F
Data received: CTRL= 3F, XYZ= 3F, 3F, 1F
Data received: CTRL= 3F, XYZ= 1F, 1F, 1F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 3F, XYZ= 3F, 3F, 1F
Data received: CTRL= 3F, XYZ= 3F, 3F, 3F
Data received: CTRL= 3F, XYZ= 3F, 3F, 3F
Data received: CTRL= 3F, XYZ= 1F, 1F, 0F
Data received: CTRL= 3F, XYZ= 3F, 3F, 3F
Data received: CTRL= 3F, XYZ= 1F, 1F, 1F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 3F, XYZ= 0F, 0F, 1F
Data received: CTRL= 3F, XYZ= 3F, 3F, 1F
Data received: CTRL= 3F, XYZ= 3F, 1F, 1F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 3F, XYZ= 3F, 3F, 1F
Data received: CTRL= 1F, XYZ= 1F, 1F, 3F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 3F, XYZ= 3F, 3F, 1F
Data received: CTRL= 3F, XYZ= 3F, 3F, 1F
Data received: CTRL= 1F, XYZ= 3F, 1F, 1F
Data received: CTRL= 1F, XYZ= 1F, 3F, 3F
Data received: CTRL= 3F, XYZ= 1F, 0F, 1F
Data received: CTRL= 3F, XYZ= 1F, 1F, 1F
Data received: CTRL= 1F, XYZ= 3F, 1F, 1F
Data received: CTRL= 1F, XYZ= 3F, 3F, 1F
Data received: CTRL= 1F, XYZ= 3F, 3F, 3F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 3F, XYZ= 3F, 3F, 3F
Data received: CTRL= 3F, XYZ= 1F, 1F, 1F
Data received: CTRL= 3F, XYZ= 1F, 1F, 0F
Data received: CTRL= 1F, XYZ= 0F, 1F, 0F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 1F, XYZ= 1F, 1F, 3F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 1F, XYZ= 3F, 1F, 1F
Data received: CTRL= 3F, XYZ= 3F, 1F, 3F
Data received: CTRL= 1F, XYZ= 1F, 1F, 1F
Data received: CTRL= 3F, XYZ= 3F, 1F, 3F
Data received: CTRL= 1F, XYZ= 1F, 3F, 1F



* * * * * * * * * * COM Port Closed * * * * * * * * * *



Any ideas to what is happening??
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 3:30 pm     Reply with quote

I forgot to tell:

Code:
#include <16F872.h>
#device adc=8

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES XT                       //Crystal osc <= 4mhz
#FUSES PUT                      //Power Up Timer
#FUSES NOPROTECT                //Code not protected from reading
#FUSES NODEBUG                  //No Debug mode for ICD
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD                    //No EE protection
#FUSES NOWRT                    //Program memory not write protected

#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)


and on main:

Code:
setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_16);


The rest is the same
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 17, 2011 4:00 pm     Reply with quote

Post a list of connections between the PIC and the MMA7455L.
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 4:47 pm     Reply with quote

Here are the schematics:


_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 4:48 pm     Reply with quote

SORRY!!!

The pins of the accelerometer are:

14-SCK
13-SDI
12-SDO
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 4:51 pm     Reply with quote

I changed your code a little bit to add the 3 accelerometers:

Code:
void accel_select(unsigned int8 n, unsigned int8 enable)
{
   if(enable==1)
   {
      if(n==1)       output_low(AC1);
      else if(n==2)  output_low(AC2);
      else           output_low(AC3);
   }
   else
   {
      if(n==1)       output_high(AC1);
      else if(n==2)  output_high(AC2);
      else           output_high(AC3);
   }
}

//----------------------------------
void Acc_Write_Register(int8 accel, int8 reg, int8 data)
{
   accel_select(accel,1);
   spi_write(((reg & 0x3F) << 1) | 0x80);
   spi_write(data);
   accel_select(accel,0);
   }

//---------------------------------
int8 Acc_Read_Register(int8 accel, int8 reg)
{
   int8 data;
   
   accel_select(accel,1);
   spi_write((reg & 0x3F) << 1);
   data = spi_read(0);
   accel_select(accel,0);
     
   return(data);
}


void main()
{
   
   int8 result, i;
   int8 Xdata, Ydata, Zdata;
   
   output_high(AC1);
   output_high(AC2);
   output_high(AC3);
   
   output_low(LED1);
   
   delay_ms(100);   // Minimum 1 ms required after power-up.
   
   setup_spi(SPI_MASTER | SPI_MODE_0 | SPI_CLK_DIV_16);

   
   while(1)
     {
      for(i=1;i<4;i++)
      {
         Acc_Write_Register(i,0x16, 0x05);
         delay_ms(30);  // Minimum 20 ms required after exiting standby
         result = Acc_Read_Register(i,0x16);
         delay_ms(20);
         Xdata = Acc_Read_Register(i,0x06); //Read X,Y,Z outputs from Sensor
         delay_ms(20);
         Ydata = Acc_Read_Register(i,0x07);
         delay_ms(20);
         Zdata = Acc_Read_Register(i,0x08);
         delay_ms(500);
         output_toggle(LED1);
         printf("ACC=%U, CTRL=%X (05 exp), XYZ=%X,%X,%X \n\r", i, result, Xdata, Ydata, Zdata);
         if(i==3) printf("\n\r");
      }
     }
}




And the results are (for different SPI speeds with 4MHz clock):


Code:
DIV/4

ACC=1, CTRL=3F (05 exp), XYZ=3F,3F,1F
ACC=2, CTRL=3F (05 exp), XYZ=3F,3F,1F
ACC=3, CTRL=3F (05 exp), XYZ=3F,3F,1F

ACC=1, CTRL=3F (05 exp), XYZ=3F,3F,1F
ACC=2, CTRL=3F (05 exp), XYZ=3F,3F,1F
ACC=3, CTRL=3F (05 exp), XYZ=3F,3F,1F

ACC=1, CTRL=1F (05 exp), XYZ=1F,1F,1F
ACC=2, CTRL=1F (05 exp), XYZ=1F,1F,1F
ACC=3, CTRL=3F (05 exp), XYZ=1F,3F,3F

ACC=1, CTRL=1F (05 exp), XYZ=3F,3F,3F
ACC=2, CTRL=3F (05 exp), XYZ=3F,3F,3F
ACC=3, CTRL=3F (05 exp), XYZ=3F,3F,3F



DIV/64

ACC=1, CTRL=00 (05 exp), XYZ=00,00,00
ACC=2, CTRL=00 (05 exp), XYZ=00,00,00
ACC=3, CTRL=00 (05 exp), XYZ=00,00,00

ACC=1, CTRL=00 (05 exp), XYZ=00,00,00
ACC=2, CTRL=00 (05 exp), XYZ=00,00,00
ACC=3, CTRL=00 (05 exp), XYZ=00,00,00

ACC=1, CTRL=00 (05 exp), XYZ=00,00,00
ACC=2, CTRL=00 (05 exp), XYZ=00,00,00
ACC=3, CTRL=00 (05 exp), XYZ=00,00,00

ACC=1, CTRL=00 (05 exp), XYZ=00,00,00
ACC=2, CTRL=00 (05 exp), XYZ=00,00,00
ACC=3, CTRL=00 (05 exp), XYZ=00,00,00



DIV/16

ACC=1, CTRL=7F (05 exp), XYZ=7F,7F,7F
ACC=2, CTRL=7F (05 exp), XYZ=7F,7F,7F
ACC=3, CTRL=7F (05 exp), XYZ=7F,7F,7F

ACC=1, CTRL=7F (05 exp), XYZ=7F,7F,7F
ACC=2, CTRL=7F (05 exp), XYZ=7F,7F,7F
ACC=3, CTRL=7F (05 exp), XYZ=7F,7F,7F

ACC=1, CTRL=7F (05 exp), XYZ=7F,7F,7F
ACC=2, CTRL=7F (05 exp), XYZ=7F,7F,7F
ACC=3, CTRL=7F (05 exp), XYZ=7F,7F,7F

ACC=1, CTRL=7F (05 exp), XYZ=7F,7F,7F
ACC=2, CTRL=7F (05 exp), XYZ=7F,7F,7F
ACC=3, CTRL=7F (05 exp), XYZ=7F,7F,7F



_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jan 17, 2011 4:56 pm     Reply with quote

What is the power supply voltage for the PIC, and for the MMA7455L ?
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 4:57 pm     Reply with quote

Damn... I have this project to do for wednesday and i am stuck in this...

I tried with the delays above, without, i checked all lines and its seems that i have all connections ok from the accelerometers to the PIC.

I am using USB 5V from my PC through a USB2TTL (serial) converter, and then on the board i use a 3.3V regulator, all the capacitors are according to the datasheets and the voltage is ~3.31V

The board was made at home, using laser printer method, soldered with solder paste in seringue and an oven with controlled temperature. All connections seems to be ok, the layout looked really very good before soldering, there are no short circuits.... Anyway, if there was problem with soldering it would not happen the same thing in the 3 accelerometers...
_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
vascotech88



Joined: 10 Mar 2009
Posts: 33
Location: Aveiro, Portugal / Lodz, Polska

View user's profile Send private message Send e-mail Visit poster's website MSN Messenger

PostPosted: Mon Jan 17, 2011 5:00 pm     Reply with quote

Here is the picture of the board (this photo is older, because now it have 'through-hole' stuff soldered. But u can see the accelerometers and the smds

Is programmed by ICSP


_________________
-----
Vasco Jose Dias Baptista
http://vascotech88.pt.vu/
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group