Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

write single channel of data using WriteWaveform method attached to multichannel DAQstream

I have two main questions, the first which corresponds to the title and is the more pressing concern.

(1) I have set up a task that contains all 32 channels (4 ports) on my PCIe-6536. I have routines to fill the buffer with a 1D array of DigitalWaveform objects. This 1D array has a length of 4 to account for the 4 ports, i.e. 32 channels. The length of each DigitalWaveform is 48 bits (sort of arbitrary). In this way, instead of filling the buffer all at once, I fill it sequentially with 32 bit wide by 48 bit long chunks, thereby avoiding the need to generate the whole buffer on my computer before using WriteWaveform to write it to the buffer.

 

However, for my eventual application, it doesn't make a lot of sense to write simultaneously to the 32 channels in individual time steps. Instead, it makes a lot more sense to write all the data for channel 0 from beginning to end in chunks of 48 bits, then write all the data for channel 1 from beginning to end in chunks of 48 bits, and so on until channel 31. Worded another way, instead of, e.g. rastering top to bottom and then proceeding to the next column, I want to raster left to right and then proceed to the next row. (In this picture, time goes left to right and the channels are arranged top to bottom)

 

The description "Writes one or more digital waveform samples to a single DOChannel in a task" for the DigitalSingleChannelWriter.WriteWaveform method looks particularly evocative. However, I must attach the DigitalSingleChannelWriter to a DaqStream object and it doesn't appear the DaqStream is itemized into individual channels, rather it contains all the channels of the Task object. Now, I could get DaqStreams for individual channels by writing multiple tasks, one for each channel, but 1) it is unclear whether multiple tasks can be run simultaneously (see http://forums.ni.com/t5/Dynamic-Signal-Acquisition/NI-DAQmx-Multiple-Tasks-on-one-card/td-p/166401) and 2) I need all the channels to be synchronized with each other and it's unclear to me how to trigger them to all start simultaneously.

 

Thoughts?

 

(2) I would eventually like to use the PCIe-6537 to output 50 Mbps on each channel for at least 10 seconds, but much more ideally for 60 seconds. This corresponds to either 50 Mbps/channel * 32 channels  * 10 seconds = ~2 gigabytes or for 60 seconds roughly 12 gigabytes. Now, the PCIe-6537 certainly doesn't have such a large buffer, but I suppose that's the point of the DMA? If I can generate and load the data into my RAM, then when I execute the Task.Start method it will stream the whole 10 seconds of data. 2 gigabytes in RAM for for 10 seconds is feasible/reasonable, but 12 gigabytes for 60 seconds isn't that reasonable. If I can generate data faster than 50 Mbps/channel * 32 channels = 200 megabytes/s, is it possible to have the PCIe-6537, e.g. output the 1st second of the data while I'm filling the RAM with the 2nd second of data and so on to the 60th second of data all the while maintaining rigid timing? Essentially, I'm imagining the card alternate pulling data from two separate sections of RAM. While the card is pulling data from one, I'm filling the other and as soon as the card finishes pulling from one, it immediately with rigid timing starts pulling from the other section (which will be full if I can generate data faster than 200 megabytes/s). Is this feasible with the DAQmx driver? Would it be possible to give me a rough pseudo code outline?

 

Notes:

PCIe-6536

VS2010

DAQmx 9.5.1

0 Kudos
Message 1 of 2
(4,659 Views)

Hi qgm,

 

When you start your task, you reserve resources on your device for that task. The NI 6536 block diagram shows these resources. Once these resources are unreserved, another task can then reserve and use these resources. The KnowledgeBase, here, explains the NI-DAQmx Task State Model. In summary, you can define multiple tasks, but these tasks cannot reserve the same resources at the same time.

 

Can you further explain what you are trying to do? You mentioned that you do not want to write to each channel simultaneously, but at the same time you would like to synchronize these channels.  For synchronization, you will need to share the same clock and start trigger. With one task for all 32 channels, you are sharing the same clock and start trigger.

 

Regarding your second question, your device uses direct memory access (DMA) to transfer data between the device and the computer memory, as explained here. You should be able to write new data to the buffer, while your device retrieves data from the buffer.  The  ContWriteDigChan_PipeSampClk example might provide the solution for you.  The location of the DAQmx shipping examples is defined, here.

Tunde S.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 2
(4,637 Views)