LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a USB-6259 to trigger itself when collecting angular position

Well, currently I am reading in a signal from an encoder, it is a counter input using the Angular Position reading and N number of samples.  I am reading in 100,000 samples at 100kHz resulting in one second of data.  In order to do this I have to use an external clock to pulse the reading.  What I would like to do is have this demo run self-sufficient by having the DAQ board also produce the 'external clock' by using one of the outputs.  I have tried it several different ways and I have yet to get it working correctly.  I have tried using the DAQ analog output using a square wave with the desired frequency output, but I couldn't get the input (the angular position) and the output (pseudo external clock using the waveform) to match up and output and input at the same time.  Is there a way I can do this, by any other means?  Using file I/O, as in loading a file when the timing is needed?  Or perhaps I am in the completely wrong direction, which very well could be.

I also tried using a counter output to output the frequency needed but that did not work either.  I have tried eveything that I could think of to get this self-sufficient.  Any help and guidance would be greatly appreciated.  Thank you very much for your time and effort.

I tried the DAQ assistants also, but those prooved to be less helpfult hen using the base DAQ blocks in setting up my own sample channel and manipulating it that way.


Michael Boyd
0 Kudos
Message 1 of 11
(3,961 Views)
Hi Michael,

The USB-6259 should be able to generate the clock and acquire data from your encoder. This article addresses the issue that you are seeing.  You can specify the internal counter output line for the clock without external wiring. This can be accomplish by enabling "Advanced Terminals" after right clicking on the constant or control that specifies your external clock.

Regards,
Kent
Applications Engineer
Message 2 of 11
(3,930 Views)
tnek,

Thank you for the response.  I am a little confused in your last post.  I tried to do what you told but the 'Advanced Terminals' does not show up for me and I guess I am at a loss of what to do next.  I am going to attach my VI.  Let me explain what I want to do a little bit deeper.  I think you are very close with what I need to do, just integrating the two together is the problem for me.

I have my current VI that is using an external signal and I would like to generate the signal using LabVIEW and the same DAQ board.  If that requires external wiring, then so be it, but if what you said, tnek, is true that I would not have to use any external wiring that would be amazing.  I would rather do it with the least amount of wiring.  I would also like these to be in the same VI if that is possible.  If not, it isn't that big of a deal.  Thank you for your help.  I think that we will be able to get this problem fixed soon.

Michael
0 Kudos
Message 3 of 11
(3,921 Views)
Hi Michael,

I apologize about skipping a step when explaining how to do this. After right clicking on the clock source terminal, select I/O Name Filtering. Inside that window, check Include Advanced Terminals. Once advanced terminals are enabled, you will be able to select the internal counter channels on your board. They will be named Ctr0InternalOutput. Also, both of these examples can be combined into one. You can either build it yourself into one VI or just copy and paste the functions.



Regards,
Kent
Applications Engineer


Message Edited by tnek on 06-25-2008 12:38 PM
Message 4 of 11
(3,899 Views)
tnek,

I see what you did in the last post and I have done the same but I am still getting the same error.  I am still a little confused on the matter of your last two statements.  Those consisting of: "Also, both of these examples can be combined into one. You can either build it yourself into one VI or just copy and paste the functions."  Are you referring to the example that you showed me in the first post and combining it with the current model that I have now?  Because in that sense, to me at least, it does not make sense since I would be opening two counter outputs under two different tasks which is a no no, which I have learned the hard way (RIP Load Bank).  Anyway, I thought that I would just have to change the source of the 'Clock Source' on my block and everything would be fine and dandy, but obviously I am wrong.  I am using Ctr0 to read in so I set the '/Dev1/Ctr1InternalOutput' as my parameter in the clock source on the front panel.  You can see this when you open the VI due to the defaults that I have previously set.  I will reattach me most current VI, although it is pretty much the same as the other one.  I think clarification of your previous statements would set me in the right direction.  Thank you again for the help.  I think it is pretty much completed.  Thank you.

Michael


0 Kudos
Message 5 of 11
(3,889 Views)
Hi Michael,

Right, I was referring to combining the Meas Angular Position-Buffered-Cont-Ext Clk.vi example with the Gen Dig Pulse Train-Continuous.vi example. This will result in a VI with one counter input task and one counter output task so there will be no conflicts. It sounds like you are routing the clock correctly so everything should be good to go.

Regards,
Kent
Applications Engineer
Message 6 of 11
(3,870 Views)
tnek,

    First off, thank you for helping me.  I got the VI up and running and all seems to be working great.  Well at least 80% of the time.  I am getting this error: "Error -200141 occurred at DAQmx Read"  I have attached a picture of the error that I am getting and a picture of VI that I am currently using (since I would have to attach my variables and project if I attached the VI).  It only happens every once in a while wherein I just click continue, on the error, and then restart the VI and then it works again like normal.  This isn't that big of a deal, but I would like the consistency to be there.  Thank you again for your help.

Michael
Download All
0 Kudos
Message 7 of 11
(3,835 Views)

Hi Michael,

What's probably happening here is that since your two tasks are essentially independent in execution, one is going to start, and possibly finish before the other starts. Since one of your tasks depends on the other to be executing, this will cause problems but not all the time (as you are experiencing). Try using your error lines or your sequence structure to force the CO task to start just before the CI task and end the CI task before the CO task. Also, make sure you're not using the Run Continuously button in this application.

Here's an idea on how to guarantee this behavior.



Message Edited by PBear on 07-01-2008 01:40 PM
PBear
NI RF
0 Kudos
Message 8 of 11
(3,807 Views)
Hello,

     I tried what PBear suggested and it seems that it did not fix the problem.  I also noticed another time that the error comes up.  First off, it shows up randomly when I click the go arrow in LabVIEW.  It pops up almost instantly after pushing go.  The other time I see it not randomly but consistently.  When I collect at a high rate and a lot of samples per channel (Still only one channel).  For example:  at 200kHz and with 200,000 samples per channel the model should run for 1 second and then stop.  It consistently gives me the error I stated in another post (with picture).  It works fine at 100 kHz and 100,000 samples per channel.  Thank you for your time and help.

Michael Boyd
0 Kudos
Message 9 of 11
(3,746 Views)
Hi Michael,
 
The error you are experiencing corresponds to samples being overwritten in the on-board FIFO of the USB-6259. The FIFO can only hold 2 samples and so data must be transferred back to the computer quickly. The ability of your computer to transfer data from the device is system dependant. You should notice that the reliability of your program increases as your rate decreases. You should also minimize the additional processing the occurs on the computer while the program is running. I have included a link to an article that discusses the USB data streaming in more detail as well as an article that discusses buffered counter benchmarks.
 
NI Signal Streaming: Sustaining High-Speed Data Streams on USB
http://zone.ni.com/devzone/cda/tut/p/id/4636
 
Benchmarks for Buffered Counter Input with M-Series Devices
http://digital.ni.com/public.nsf/allkb/72A7E41EE5A8756A862571DA0076F1D7?OpenDocument
Steve B

Message 10 of 11
(3,706 Views)