LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

LIFA Reading Encoder readings?

I was wondering if LIFA has any encoder vi's coming out or has anyone created any custom ones? If not could this functionality be built-in easily? I want to use quadrature encoder feedback on my stepper motors for my cnc machine so I want to measure the counts and direction. Thanks. LIFA 2.0 is awesome!

Is Fred going to upload his etch-a-sketch vi (Mainly his g-code parser)?

-Ryman

0 Kudos
Message 1 of 6
(5,476 Views)

Hey Ryman,

We don't have plans for any encoder VI's but we can definitely add it to the feature list for the next major release. I think you would be able to build the functionality such that the encoder processing is all done on the Arduino and then LabVIEW just polls every once in a while for the aggregated information.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 2 of 6
(3,208 Views)

Okay, so would I insert the code for the arduino to process the encoder somewhere in this file maybe where it says "  // Place your custom setup code here" and then how would I get LIFA to poll that information from the arduino? Thanks alot.

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

**

**  LVFA_Firmware - Provides Basic Arduino Sketch For Interfacing With LabVIEW.

**

**  Written By:    Sam Kristoff - National Instruments

**  Written On:    November 2010

**  Last Updated:  Dec 2011 - Kevin Fort - National Instruments

**

**  This File May Be Modified And Re-Distributed Freely. Original File Content

**  Written By Sam Kristoff And Available At www.ni.com/arduino.

**

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

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

**

** Includes.

**

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

// Standard includes.  These should always be included.

#include <Wire.h>

#include <SPI.h>

#include <Servo.h>

#include "LabVIEWInterface.h"

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

**  setup()

**

**  Initialize the Arduino and setup serial communication.

**

**  Input:  None

**  Output: None

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

void setup()

  // Initialize Serial Port With The Default Baud Rate

  syncLV();

  // Place your custom setup code here

 

}

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

**  loop()

**

**  The main loop.  This loop runs continuously on the Arduino.  It

**  receives and processes serial commands from LabVIEW.

**

**  Input:  None

**  Output: None

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

void loop()

{  

  // Check for commands from LabVIEW and process them.  

  checkForCommand();

  // Place your custom loop code here (this may slow down communication with LabVIEW)

 

 

  if(acqMode==1)

  {

    sampleContinously();

  }

}

0 Kudos
Message 3 of 6
(3,208 Views)

Right,

I would think you would want to add another mode (like continuous mode above) which you can turn on with a command and when its turned on you perform reads on the encoder channels and write the calculated values to global variables which you can return when another command is called. So I think you would add three custom commands into the LIFA command structure- turn on encoder mode, get encoder values, turn off encoder mode.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 4 of 6
(3,208 Views)

This is exactly what I'm needing right now.  If this has been done by anyone let me know!  If not, I will probably try and write it up though I'm not all that experienced with Arduino specific code.

0 Kudos
Message 5 of 6
(3,208 Views)

I would be very interested in this too. unfortunately i have no experience with arduino code. so if anyone out there has experience with arduino code and endoders please help us out.

0 Kudos
Message 6 of 6
(3,208 Views)