03-28-2012 08:48 AM
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
03-28-2012 08:55 AM
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.
03-28-2012 02:07 PM
We are novices with labview and have only ever worked with LIFA...how would we go about doing that?
03-30-2012 08:14 AM
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?
07-02-2012 11:15 AM
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.
07-02-2012 06:00 PM
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).
11-16-2012 07:37 AM
Hello
I need to the library integrated into LIFa for encoder.
Can somebody help me to develop this?
CPalha
11-16-2012 08:07 PM
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.
11-16-2012 08:59 PM
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
11-16-2012 11:10 PM
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.