04-08-2009 07:12 AM
Dear All,
I have set out to create a many channel system using the labview realtime operating system, and PXI6733 and PXI6133 cards. My experiment is very time critical, so i am keen to avoid any jittering if possible.
My plan was I thought quite simple, and I assumed similar to what other people would be doing. However I am stumbling because I don't know the correct APIs to achieve my desired design, so perhaps I am doing something crazy.
In pseudo code:
init
----
for each card
{
for each channel
{
initialiseChannel
(DAQmxCreateAOVoltageChan)
}
}
thread A
-----------
for each card
{
for each channel
{
populate a buffer with a wave function
write the buffer to the card
(DAQmxWriteAnalogF64)
}
}
Signal thread B that the data is ready
thread B
----------
DAQmxStartTask(handle)
Signal thread A to prepare the next lot of data...
Obviously then, the requirement is that thread A will create a buffer full of data in the time it takes thread B to output that data.
This all raises some questions:
1. Since I cannot use the same handle for all cards, how can I start all cards playing simultaneously?
2. When I write the data to the card: I intended as above, to write the data for each channel, but I obviously can only address the card handle, so do I have to write the data for all channels as a single memory block? This would be inconvient since I may not necessarily want to use all channels on all cards, so I was hoping to minimse the processing time (in thread A) by only calculating the used channels.
3. If the wave functions I want to write out of the card are longer than the buffer size of the card, then can I write a second buffer to the card, while it is playing the first, such that I can swap them instantaneously on completion, and hence maintain an uninterupted evolving signal? What is the API for that? Or is there an API for a FIFO buffer on the card in CVI?
I'd be grateful for any comments you may have.
James
05-05-2009 04:22 AM
Hi James,
To try and answer your questions:
1. You can configure a hardware or software trigger in order to start a task. You can then configure the both tasks to start from the same Trigger.
2. You will only write the data to the FIFO for the channels you plan to use, so you will only be referencing the channels you have configured in the task rather than all of the channels on the card.
3. In order to periodically write a signal to a FIFO you canconfigure a Continuous output task, and specify to not to allow regerneration, so that you can write over the FIFO and change the signal which is output from the channel.
I have attached an example which ships with the driver and should give a bit more of an insight into how to synch AO and AI
For more information on how to configure the Trigger and Regeneration modes navigate to Start»All Programs»National Instruments»NI-DAQ»Text-Based Code Support»NI-DAQmx C Reference Help, this will provide a good reference for using the API