LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

10-bit PWM Encoder

Hello, all. We are trying to use a 10-bit PWM encoder and we aren't sure how to get it to work...in Arduino, we got it to work with the pulsein() function, but we don't know what in labview works like the pulsein() function...is there a way to do this?

Here is the reference page for the pulsein() function: http://arduino.cc/en/Reference/PulseIn

0 Kudos
Message 1 of 12
(10,725 Views)

We don't have support for the pulsein() function built into the toolkit. If you want to be able to use it in LabVIEW you will need to write a custom command. To do this you can take a look at how the current commands are set up (something like Analog Read) and replicate that with a new command number and a new function call on the Arduino side.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 2 of 12
(4,166 Views)

We are novices with labview and have only ever worked with LIFA...how would we go about doing that?

0 Kudos
Message 3 of 12
(4,166 Views)

Ok so basically we need to read a signal and create a timer that reads how a pulse is hi and return the value in microseconds. How would we do that?

0 Kudos
Message 4 of 12
(4,166 Views)

I was just surfing and saw your question.  It wasn't long ago that I was wondering how to do something similar, so I hope it's not too late for your project.

There's a sketch (arduino program) that runs on the arduino and executes different things.  At the end of this FAQ, the idea for the sketch is explained:

https://decibel.ni.com/content/docs/DOC-16024

As long as we want to use what that sketch can do, we can implement anything in LabVIEW.  But if there are arduino commands not in the sketch, we'd have to add them.

Basically, you would add more functions to this to do what you would want to do, with a corresponding command that LabVIEW could send it to execute it.  There is a table of the packets used  here:

https://decibel.ni.com/content/docs/DOC-16740

So, for example (making this up) you'd create a new function in the sketch, perhaps named Pulse, and use the command 0x1E to start it.  You would also parse out any arguments given by LabVIEW, and then return any return data by passing it back over serial.  Each of the commands are handled in a similar way, and if you follow that basic pattern, it's a good starting point.  Then you would recomplie and upload it again to the arduino. 

0 Kudos
Message 5 of 12
(4,166 Views)

The best method for this is using the encoder library integrated into LIFA.  It uses the Arduino's interupt pins which is much better than pulsein for a quadrature encoder.  I only needed to add two new LabVIEW functions (that was the easy part).

0 Kudos
Message 6 of 12
(4,166 Views)

Hello

I need to the library integrated into LIFa for encoder.

Can somebody help me to develop this?

CPalha

0 Kudos
Message 7 of 12
(4,166 Views)

I plan on posting my encoder code when I am again able to access an Arduino and a quadrature encoder.  Sadly, that will be sometime in January.

0 Kudos
Message 8 of 12
(4,166 Views)

Hello Nathan,

The original poster is referring to the PulseIn function.  See first message in this thread. The original poster is not referring to a quadrature emcoder.

Hrh1818

0 Kudos
Message 9 of 12
(4,166 Views)

I was not responding to the original poster.  The person to whom I was responding did not say what type of encoder he or she is using.  It happens often that someone who posts after a significant time after the thread was created that they are not actually referring to the original context.

When we get clarification, we can give a better answer.

0 Kudos
Message 10 of 12
(4,166 Views)