11-09-2013 09:02 AM
Hi all,
I am looking for a way to write to several analog channels at the same time. In my code, I didnt' pay much attention to that, I just have them placed in the the same frame in the flat sequence such that they might be started to write simultaneously. However, sometimes they might not working perfectly. I am reading something on DAQmx and I found that there is something call virtual channel so I have put more than 1 channel into a unit (called virtual cahnnel), so I can write something to it at the same time. Here are my question
1) what's the different between virtual channel and channel group? If I write a array of 3 elements to a channel group (consists of dev1/ao1, dev1/ao2 and dev1/ao5), am I writing to channel group or virtual channel?
2) can I bind different channels from different devices to form a virtual channel, e.g. dev0/ao0 dev1/ao0 dev2/ao0?
3) can I bind different type of channel to form a virtual channel, e.g. dev0/ao0, dev0/port0/line0?
4) last question is about synchronization on writing to a virtual channel (or channel group?) Last say I have a pulse train each pulse is separated in time by 1.2ms and total time is 122.4ms. The pulse train will be sent to dev0/ao3, and at 12ms after start send very first pulse of the train, I need to write two analog signal to dev1/ao1 and dev1/ao5. In my current code, create a flat sequence, start the task for sending the train in the first frame, put delay in second frame and delay for 12ms, write dev1/ao1 and dev1/ao5 in the third frame. For some times, this gives me acceptable timing but not always. I wonder how does it help to use virtual channel?
In the similar situtation, what about if instead of writing to two analog channel, I write to one analog channel and one digital channel?
Thanks.
11-11-2013 06:05 PM
1) virtual channel is created per task and contains a collection of settings such as a name, a physical channel, input terminal connections, the type of measurement or generation, and can include scaling information.. A virtual group is specific to digital IO and has to deal with the way you read/write data off/to the port
2) yes you can create a task with physical channels from multiple devices assuming they are comparable writes (ie all analog or all analog read, or all digital) but they will have the same channel characteristics (see answer above)
3) no you cannot create a task that handle an AO and a DO from with in the same task
4) if you created a task you are using a virtual channel. The only way to ensure timing is to use hardware timing (ie onboard sample clock of you DAQ card) otherwise the reads/writes are basically interrupts and you are at the mercy of the OS to service the interrupt request
if you need more information please repost with more questions, include your DAQ hardware, and any code pictures to give us a better idea of what you are trying to accomplish and how you are going about it