LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to demux an all channel array into arrays per channel?

Hi,
 
I'm having a problem to demux an array into different arrays per channel.  So f.i. I can send each array to an indicator.
Like in a Strip chart, it's possible to add traces and then it is OK, but anything else I can't find.
 
 
regards
Drepen
0 Kudos
Message 1 of 6
(3,841 Views)

Hi Drepen, if you can detail a little more how your application manages acquisition we will be able to help you more precisely. Anyway, normally an acquire-demux-and-disply application can be structured as follows:

1. Define your acquisition task and execute acquisition: it will return an array on measures in per-sample order (sample1channel1, sample1channel2 ... sample1channelN; sample2channel1, sample2channel2 ... sample2channelN ... sampleMchannel1, sampleMchannel2 ... sampleMchannelN)

2. Use Scan_Demux to organize your array in per-channel order (sample1channe1, sample2channel2 ... sampleMchannel1; ... sample1channelN ... sampleMchannelN)

3. Divide the array into sub-arrays per channel. I have found very useful in this respect ConvertArrayType function, which permits me also to change initial type of the array to final type (acquisition function return raw data in a short array so I need to convert to engineering measures after acquisition completion: copying channel measures into a double array I can apply to this the proper conversion coefficients)

I hope this informations can help you to solve your doubts, otherwise add some details to let we help you more precisely

Roberto

Message Edited by Roberto Bozzolo on 12-16-2005 11:57 AM



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 6
(3,835 Views)
thank you
 
well I'm using DAQPad 6016.
Is there something in perticular you need to know?
 
Drepen
0 Kudos
Message 3 of 6
(3,828 Views)
Hi, Roberto
 
I normally use the DAQmx driver, and the data is stored in float64 format. So Scan_Demux gives a Type error.
 i have:
 
 
DAQmxReadAnalogF64(task, numberOfSamples,10.0, DAQmx_Val_GroupByScanNumber,data, arraySize, &sampsPerChanRead, NULL);
SetCtrlAttribute(panel, PANEL_CHART, ATTR_NUM_TRACES, numChannels);
PlotStripChart(panel,PANEL_CHART, data, arraySize, 0,0 VAL_DOUBLE);
 
Now i want to take the array "data" and demux it to (howmany) --> "numChannels" arrays. For further use.
 
Drepen
0 Kudos
Message 4 of 6
(3,811 Views)

Unfortunately I am actually using traditional daq driver, so I cannot help you in this respect. Anyway, parameter DAQmx_Val_GroupByScanNumber let me assume there is another option that returns an array grouped per channel. This will make difficult to plot measures on the strip chart but will ease splitting the array.

In any case, if you cannot locate a replacement of SCAN_Demux inside daqmx driver you can manually reorganize the array with a loop like this one:

for (i = 0; i < sampsPerChanRead; i++) {
 for (j = 0; j < numChannels; j++) {
  newFile[i + (j * sampsPerChanRead)] = data[i * numChannels + j];
 }
}

(Please debug it carefully: since I have no need to use it this is only an attempt...)



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 6
(3,804 Views)

Hi Drepen.

I believe you will find some useful information in this thread.

Regards,
Colin.

 

0 Kudos
Message 6 of 6
(3,787 Views)