LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Insert Code in FIRMWARE

Hi,

This is my first time working with arduino, but first I would like to thank you for the tremendous help that you all had given to me in this first steps Arduino/Labview.

The problem is: I want read the frequency or rpm of a dc motor using a counter presente(Digital Input) in arduino. I had just mount all hardware using a photointerruptor, which give a pulse of 5V, the frequencies are low (150Hz). The motor is controlled by a PWM.

So I search in some forums and find this library, my principal question is how I can integrate this library in firmware LIFA_BASE and how I read in Labview the frequency.

I tested using only the library and my code with Arduino 1.0, and everything works good. Only I want is integrate everything. How I Can do this?where I  place the code?

Thanks in advance.

Nelson


0 Kudos
Message 1 of 4
(4,323 Views)

If you post your working code it might be easier for someone to implement it with LabVIEW (this would make it so we don't have to learn how the library works completely).

0 Kudos
Message 2 of 4
(3,115 Views)

You are right.

I know that I need include the library file "FreqMeasure.h" in first file o Firmware, which is LVIFA_BASE, and I should add instructions or part of the code, see below, probably in LabVIEWInterface, Where and how integrate all?. The signal that I get from sensor is inputed in digital Pin 8.

Another trouble is how read this data from arduino.

The code in Arduino 1.0 to measure the frequency:

#include <FreqMeasure.h>

void setup() {

  Serial.begin(57600);

  FreqMeasure.begin();

}

double sum=0;

int count=0;

void loop() {

  if (FreqMeasure.available()) {

    // average several reading together

    sum = sum + FreqMeasure.read();

    count = count + 1;

    if (count > 30) {

      double frequency = F_CPU / (sum / count);

      Serial.println(frequency);

      sum = 0;

      count = 0;

    }

  }

}

To test this, put the library downloaded in:  arduino-1.0/libraries/ . And from Arduino you can open this.

0 Kudos
Message 3 of 4
(3,115 Views)

Hey Nelsos,

You will want to integrate any additional functionality as additional commands in the LabviewInterface. To get used to how this is done I would start by adding a simple command that already exists- digital input for example to get an idea of how the firmware is set up.

Kevin Fort
Principal Software Engineer
NI
Message 4 of 4
(3,115 Views)