04-29-2010 07:06 AM
Hello,
I'm using DAQmx NI-USB-6259
I have problem with with parallel
execute writing analogue signal (for example 1000 points
per 1second) on physical channel Dev1/ao0 and at the same time read
1000 points per 1second from physical channel Dev1/ai0
how to do this?
I've tried to use DAQmxExportSignal but it doesn't work well or simply I
don't know how to do it
properly
Maybe should I use another
function?
Best regards,
AndrzejS
Solved! Go to Solution.
05-03-2010
04:29 AM
- last edited on
10-06-2025
04:31 PM
by
Content Cleaner
Hi Andrzej,
You should be able to find DAQmx examples for VB6 under the following folders:
Windows Vista examples are located at:
C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\Visual Basic 6.0\...
Windows XP or 2000 examples are located at:
C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\Visual Basic 6.0\...
Examples are located at:
C:\Program Files\National Instruments\NI-DAQ\Examples\Visual Basic 6.0\..
Synchronizing an analog output and analog input task using the DAQmx driver API should be done same way as in LabVIEW, thus check this link to see the synchronization concept.
I hope this helps!
Regards,
Barna
National Instruments
05-06-2010 02:24 AM
05-06-2010
04:54 AM
- last edited on
10-06-2025
04:32 PM
by
Content Cleaner
Hi Andrzej,
I am glad you managed to synchronize the analog output and analog input tasks.
Can you be more specific on what it means "doesn't work". Do you receive an error? Or the delay is not there? How do you trigger the two tasks? Try to triggering the AO task than start the AI task with either a different trigger type (i.e. Analog edge and set level to close to stabilized value) or with the Start.Trigger.delay function calls.
Let me know how it works.
Regards,
Barna Dobai
National Instruments
PS. Have you checked this page: Getting Started with NI-DAQmx: Main Page
05-06-2010
06:48 AM
- last edited on
10-06-2025
04:33 PM
by
Content Cleaner
Hi Barna,
I don't receive any errors. Simply, I can't observe any delay. I'm using a code which part is bellow:
' I trigger task using function:
DAQmxErrChk DAQmxCfgDigEdgeStartTrig(taskHandle_X, "ai/StartTrigger", clockEdge) 'trigger the two task
' here I try to put to the code Start Trigger delay:
DAQmxErrChk DAQmxGetStartTrigDelay(taskHandle_X, 0.04) ' 40 milisecond delay
DAQmxErrChk DAQmxGetStartTrigDelayUnits(taskHandle_X, 10364) 'delay units = second
'the Write Task writing 10samples e.g. 1V, 2V, 3V...10V. It takes exacly 0.5s:
DAQmxErrChk DAQmxWriteAnalogF64(taskHandle_X, numSampsPerChannel, True, 10#, _
DAQmx_Val_GroupByScanNumber, Data(0), sampsPerChanWritten, ByVal 0&) ' writing samples to AOchannel
'at the same time program read values from Read Task:
DAQmxErrChk DAQmxReadAnalogF64(taskHandle_X_Read, (numSampsPerChannel + Me.zgranieOI.Text), 10#, _
DAQmx_Val_GroupByScanNumber, DataRead(0), (numSampsPerChannel + Me.zgranieOI.Text), _
(numSampsPerChannel + Me.zgranieOI.Text), ByVal 0&) ' reading samples from AIchannel
'This function read e.g. 0.5V, 1V, ....5V in response on writing values. These values aren't stabilized (because writing input and reading response from detector at the same time)
'I know that this not working because when (for checking) I set 75 millisecond delay I should read values something like:
'1V, 1.5V, ....5V, 5V =>the response should be shifted.
Yes I check this page. I've found a good example http://zone.ni.com/devzone/cda/epd/p/id/905. But it is for .NET and I don't know how to do it under VB6 😞
Best regards,
Andrzej
05-10-2010 07:18 AM
Hi Andrzej,
You've found a great example actually. Now you just need to implement it in VB6 :). Basically what you'll have to make sure is that you configure the analog output task first than the analog input task. Thank you'll have to trigger the analog output task than configure the analog input task trigger to start with delay, as you can see in the picture below. Try to implement the trigger delay in the same way as in the screenshot below (note: the dark green wire - error wire - will indicate the order of calling the DAQmx functions in the Labview VI)
I hope this helps.
Regards,
Barna D.
National Instruments
05-09-2011 12:53 AM
Hi Barna,
one year ago you helped me with synchronization of the analog output and analog input tasks. Your help was very useful.
During this time my project groves and now, I have similar (but more complicated) problem 😞 and I hope that again you give me a smart solution...
I'm using DAQmx NI-USB-6259. I have to read not one but three AI voltage at the same time (or with very small delay) triggered by the analog output task.
Could you help me with this problem?
It is possible to read and storage three independent voltages at the same time (or with very small delay)?
Best regards,
Andrzej
05-10-2011 10:10 AM
Hi Andrzej,
Yes it's possible, but with your device not at the same time, just with a small delay (about 1 us).
The way is almost the same, you have to add 2 more analog input channels to your task, and use the read function for multiple samples. Just check the Acq-Int Clk VB example.
I can't help with particular code, because I'm not familiar with VB, but daqmx functions are very similar, so if this modification is 3 click in LabVIEW, then it must be very easy in VB too. You handle tasks, if your task contains more ai channels you will get back samples for all channels.
I hope this helps, or just let me know if I misunderstood something.
Gabor