LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use "select" to compare elements from an array?

Hi,

I am trying to create a very basic analog to digital converter. I have a 1D waveform (500 elements) which I compare to a constant (true or false), and then I send the 1D boolean into a for-loop to output a high or low value depending on if the comparison was true or false.

 

I can input a 1D array into the "select" function, but I don't know how to output a 1D array from the "select" function. How can I output a 1D array from the "select" function? Did I do it right in the attached VI?

 

The attached VI doesn't work because it says my "application is not able to keep up with the hardware acquisition".

 

Thanks,

W

0 Kudos
Message 1 of 3
(2,679 Views)

For starters, track the 'number of samples written per channel' output of the 'DAQmx write' and wire that to an indexing item on the loop.  Then add an indicator to follow the events.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 2 of 3
(2,629 Views)

Hi WCSRI,

 

The error you posted is actually unrelated to your use of the select function. Your posted code is using auto-indexing to feed the values in your double array into the for loop one at a time and then sends them to an output array. This is fine.

 

With regards to the error code, this error is being thrown because you are creating a DAQmx task without specifying a clock and trying to use it. Then, the DAQ Assistant task is overrunning the buffer that stores input because your writes are unable to keep up with the 75 kHz read rate. You should match the rates of both the producer (read) and consumer (write) to prevent errors like the one you are getting.

 

Before continuing to program, I would recommend checking out a few learning resources:

Using Producer/Consumer Architecture in LabVIEW

Getting Started with DAQmx

The NI Example Finder can also be VERY helpful for learning how to build standard LabVIEW architectures. You can find it under the help tab in LabVIEW.

 

And finally,

Consider Taking/Retaking LabVIEW Core 1 and 2 - this will help resolve confusion about what is causing your errors and help you ask the right questions so that we can help you find a solution as quickly as possible!

 

If you check out these resources and still cannot find the answer to your questions, feel free to follow-up here. But be sure you understand how to use each of these tools at a basic level first. I would also recommend moving away from DAQ Assistant since it seems you understand how to use DAQmx for data acquisition, but that is up to you.

 

Best,

 

Duncan W.

0 Kudos
Message 3 of 3
(2,615 Views)