Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   ADXL345 SPI Accelerometer (http://www.chiefdelphi.com/forums/showthread.php?t=111821)

Team3763 Adam 22-01-2013 18:36

ADXL345 SPI Accelerometer
 
How do you set up the code for the ADXL345 SPI Accelerometer? I opened up the example under the example finder, but I don't know where to put the code or what I need for read, range, etc.

RyanN 23-01-2013 12:36

Re: ADXL345 SPI Accelerometer
 
Quote:

Originally Posted by Team3763 Adam (Post 1220199)
How do you set up the code for the ADXL345 SPI Accelerometer? I opened up the example under the example finder, but I don't know where to put the code or what I need for read, range, etc.

The example is all you need. You connect the sensor, as shown on the Front Panel, and you hit the Run button to watch it work.

You'll have to change the IP address on the Project Explorer to your team's IP address.

Team3763 Adam 23-01-2013 14:37

Re: ADXL345 SPI Accelerometer
 
How do I incorporate this into our team's current code which features drive, camera, joystick, etc.?

Alan Anderson 23-01-2013 20:03

Re: ADXL345 SPI Accelerometer
 
Quote:

Originally Posted by Team3763 Adam (Post 1220582)
How do I incorporate this into our team's current code which features drive, camera, joystick, etc.?

In general, everything left of the loop in an example goes in Begin, and everything right of the loop goes in Finish. The contents of the loop (except for the delay) goes in Teleop, or wherever you need to read the value. Do not copy the Start/Stop Communication functions.

The Open function produces a Device Reference. You'll need a way to make it available in other VIs; that's what the RefNum Registry Set and Get functions are for. Follow the pattern you see with Joystick and Motor refnums in the code. The SPI Set/Get functions are in the WPI Robotics Library -> Communications subpalette.

Things will probably work best if you copy the contents of the ADXL345 SPI Driver folder from the example project into your team's code, but I think you can get away with leaving them where they are as long as you don't make any changes to them.

Doug Norman 29-01-2013 12:58

Re: ADXL345 SPI Accelerometer
 
You might also look at Tutorial 7 - Integrating Examples into Robot Code. You can find this on the Tutorials tab of the LabVIEW Getting Started Window. If you already have LabVIEW code open, choose View>>Getting Started Window...

tcjinaz 08-02-2013 20:35

Re: ADXL345 SPI Accelerometer
 
Now, how to debug why there's nothing. No errors, no change in data. From two of the three boards we have (haven't tried the third). Will I need to put a scope on the send and receive lines?

RyanN 09-02-2013 11:31

Re: ADXL345 SPI Accelerometer
 
Quote:

Originally Posted by tcjinaz (Post 1230174)
Now, how to debug why there's nothing. No errors, no change in data. From two of the three boards we have (haven't tried the third). Will I need to put a scope on the send and receive lines?

Have you updated LabVIEW recently? There was a bug with the SPI communication a few weeks back, and it was fixed with an update, then more recently, some other bugs were squashed wtih the latest update.

Specifically, there is were two updates for LabVIEW. Here's the latest updated.

Next, if you haven't, update the utilities and driver station as well. Those are available from the link above as well. To note, you MUST have the newest driver station software installed prior to competition.


All times are GMT -5. The time now is 10:47.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi