09-20-2010 07:54 AM
Hey guys
I am trying to produce data samples for the position of a stamping press at around 1000 Hz using an absolute encoder which is connected to the NI DAQ.
Couple of steps that I am trying to program but cannot figure out:
1) use a hardware clock to trigger acquisition of the data at selected rate
2) synchronize the three DAQ modules that I have so that all the data is received at the same time
the hardware I have does not seem to have any counters. Couple of examples that I read would not run because of this.
Any thoughts? If there are examples/tutorials regarding this issue that I have missed please let me know.
Thanks
Solved! Go to Solution.
09-21-2010 06:32 AM
I am still working on the problem.
I was successfull in synchronizing the three DAQ modules that are installed on the chassis.
I also realized that I can use hardware clock without using timers (added a timer VI to Read Dig Chan.vi in the example finder).
However, when i try to get data points with a certain clock rate that i specfy I receive an error:
Error -200284 occurred at DAQmx Read (Digital 1D Bool NChan 1Samp 1Line).vi:1
Measurements: Some or all of the samples requested have not yet been acquired.
To wait for the samples to become available use a longer read timeout or read later in your program. To make the samples available sooner, increase the sample rate. If your task uses a start trigger, make sure that your start trigger is configured correctly. It is also possible that you configured the task for external timing, and no clock was supplied. If this is the case, supply an external clock.
Property: RelativeTo
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value: 0
Task Name: _unnamedTask<1>
The encoder is running at this point and it should be sending signals, somehow the DAQ never receives it. Ive tried increasing the timeout period which only delays the error message.
I talked to an application engineer from NI which helped a lot but I couldnt get this problem to be solved.
Anyone had this problem before or know how to fix it? I am attaching the VI I have .
Thanks guys.
09-21-2010 06:47 AM
I also realized that I can use hardware clock without using *** counters *** (added a timer VI to Read Dig Chan.vi in the example finder).
09-21-2010 10:51 AM
Hi _Nik_,
You can find an article thoroughly explaining the details of that error on the NI website. I would suggest that you use a digital start trigger so that you can be sure that the acquisition does not start before samples are ready. Also, is there a particular reason why you are using the AI sample clock for a digital input task?
On a side note, I'd recommend making your code easier to read. Instead of a massive amount index arrays, you can simply this by using a For loop with one index array that uses auto-indexing and the iteration terminal to split the data array accordingly.
09-23-2010 06:28 AM
Hi BROhan,
Thanks for your reply.
I am using AI sample clock for a digital input task as the chassis I have (cDAQ-9172) does not have a separate circuit for a DI clock therefore, AI clock can be used as a source for digital input sample clock. I got this info in the user manual for the chassis.
I will try to add a trigger like you suggested. Although, Im not sure which options to pick if I add a trigger? This is my first time using LabVIEW so Im very inexperienced with the modules.
Would the code run significantly slower if I add a for loop to go through the array index? because I am trying to read an encoder with 1000Hz frequency (if possible) so I wanted to make the code as simple as possible.
Thanks for your help
09-24-2010 09:01 AM
Ah, makes sense that you would need the AI sample clock. As far as the digital trigger, I would suggest looking at the Digital Edge. Also, running that many Index array functions will not be done completely in parallel (unless you have a large multicore processor), so I would recommend using a For loop so you can organize a little bit better. If you see that this is causing problems, then you can always retun to your original method.
09-24-2010 10:11 AM
Hey Rohan,
Thanks a lot for your help. I was tlaking to a National Instruments Applicaiton Engineer yesterday and he told me the problem was regarding the timing vi's clock source option- instead of using ai/SampleClock I had to use the 100kHz TimeBase clock which was not displayed in the list until I checked the "ListAdvanced Terminal" option in the I/O Name filtering dialog box. You have to right click the constant/control for the clock source and select I/O name filtering to open that dialog.
Thanks for all your suggestions I will try to implement it and check the performance.
Nik