Hi,
It is actually recommended not to start and stop tasks inside your loop. The opening and closing of tasks is only opening the communication to your device. Once you have done that you can write/read (based on what kind of task it is), as many times as you want.
So, in your while loop you do not need to start and stop your task. You can set up your task to be continuous. You can do this in the configuration using the DAQmxCfgSampClkTiming (TaskHandle taskHandle, const char source[], float64 rate,
int32 activeEdge, int32 sampleMode, uInt64 sampsPerChanToAcquire); function.
The sampleMode parameter can be set to
DAQmx_Val_ContSamps for continuous sampling. In this mode, you can acquire or generate samples inside your loop till you stop the task.
You can find more information on all the different DAQmx functions by selecting
Start >> Programs >> National Instruments >> NI-DAQ >> NI-DAQmx C Reference Help. Most of these C functions are similar to what are used in VB6 as well.
If you are looking for examples you can actually refer to the ANSI C examples that will be installed with DAQmx. They are very similar to programming in VB6. Please look at this knowledge base article for more help on this.
NI-DAQmx Support in Visual Basic 6.0NI-DAQmx Examples for Visual Basic 6.0You will have to create seperate tasks for different operations. For example, you will have one task for analog input and one task for digital IO.
Hope all of this helps.
Regards,
Raajit L
National Instruments