LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

add data from DAQmy Read (Analog 1D Wfm NChan NSamp) to shift register

Solved!
Go to solution

I am having problems when trying to add data from DAQmy Read (Analog 1D Wfm NChan NSamp) to shift register inside timeout event case structure. The data from DAQmy Read is 1D array of 3 waveforms (I am using 3 channels). I tried with Build array (and also with additional For loop, to build each channel data separately), but with no success. Any suggestions, ideas?

 

As I am having some problems attaching .vi file, I have posted a link where to get the zip package of files:

https://dl.dropboxusercontent.com/u/12580896/vibration_meas_V7.zip

0 Kudos
Message 1 of 15
(4,268 Views)

Dear avstenit,

I am not sure what is the problem. You can create a shift register containing an array of waveform without any problem. There is no need for using for loops or anything else.

0 Kudos
Message 2 of 15
(4,221 Views)

I think the function you are looking for is Append Waveforms.vi.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 15
(4,206 Views)

I have tried with Insert into Array, Append Waveform and Build Array.  Below is example using Append Waveform. The data (waveform) is added (appended) to shift register as I also checked this with probe every time this timeout  event case is executed.

 

use_append_waveform_timeout.png

 

 And when the measurement is finished (case structure is not running any more) I then try to run another proces in event case Analysis (see figure below):

 

use_append_waveform_analysis.png

 

 I get the following error (see figure below):

use_append_error.png

 

 

0 Kudos
Message 4 of 15
(4,193 Views)

Hi avstenit,

 

as long as your event structure has a lot of "default if unwired" output tunnels it is very likely that you will lose precious data while executing several events…

 

Solution: use more wires!

 

Btw: What's the purpose of a TimeOut event when the timeout input is unwired?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 15
(4,182 Views)

Hi,

the problem is, that in some cases of the event structure you don't connect the wires transferring the acquired data from one iteration to another:

 

connections.JPG

 

Every time you enter a case with "Use Default If Unwired" option on and no wire connected on the input, the dataflow is disrupted and you lose all the data - it is replaced with a default value (in this case empty waveform).

 

Connect the wires in all cases of the event structure remembering about the dataflow (even if you are not using them inside) and it should work fine.

0 Kudos
Message 6 of 15
(4,181 Views)

Haha, seems GerdW was 2 minutes faster 🙂

0 Kudos
Message 7 of 15
(4,172 Views)

I have edited the code by your suggestions (connected every case of shift register), but I think the problem is not solved.

 

use_append_waveform_timeout_additional.png

In the attachement there is a code that should append waveforms in for loop, but if I check data with indicator, there is only data in indicator scaled signals [EU], but there is no data (of any kind) in indicators before append, after append and  in analysis (event case Analysis). Channels used are ai0, ai1, ai2 (cDAQ2Mod5). Any ideas? 

0 Kudos
Message 8 of 15
(4,151 Views)

Hi avstenit,

 

there is no data (of any kind) in indicators before append, after append and  in analysis (event case Analysis)

When there is no data before your FOR loop then there will be no data after FOR loop. THINK DATAFLOW!

 

You need to check WHY there is no data in "before append" - we cannot as you only show an image of that single case…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 15
(4,146 Views)

I am having problems with uploading .vi file as I always get error of wrong file type. On the link you can get the file:

https://dl.dropboxusercontent.com/u/12580896/waveform_to_shift_register_V2.vi

 

About the for loop, the situation is the following:

- into for loop goes before append (at first execution without data from shift register)

- into for loop goes scaled signals [EU] (has data at every execution, data form is 1D array of waveform)

- out of for loop goes after append (this should have data appended fof both

- inside the for loop the two input waveforms are appended to get one waveform (array element wise)

 

IYou've forgoten the scaled signals [EU] input in the for loop or not?

0 Kudos
Message 10 of 15
(4,141 Views)