Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Error using DAQmxReadAnalogScalarF64 Function

I am new to NI products and have a simple job to get done but this is turing out to be much mroe time consuming than it should be. I know I should switch to .NET but I am familair with VB6.0 and just need to get this job done and move on. All I need to do is to read and write to the USB 6008 DAQ module with VB6.0. I've tried using one of the examples but I keep getting a divide by zero error on the following two lines of code:
 
DAQmxErrChk DAQmxReadAnalogScalarF64(taskHandle, 10#, data, ByVal 0&)
acquisitionDataTextBox.Text = CStr(data)
 
If I comment out either one of these lines I don't get the error. I've looked through help files and can't figure out the problem. VB is at SP6. Any assistance would be much appreciated. Thank you.
0 Kudos
Message 1 of 5
(8,206 Views)
Hi ,
Unfortunately this is an issue in the underlying driver for the USB device. It should be fixed in the next DAQ release.
 
One way you could work around this problem is by having a delay after the read and the next line of code.
 
i.e
 
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
 
DAQmxErrChk DAQmxReadAnalogScalarF64(taskHandle, 10#, data, ByVal 0&
Sleep(250)
acquisitionDataTextBox.Text = CStr(data)
 
Hope this helps...
 
 
Nandan Dharwadker
Staff Software Engineer
Measurement Studio Hardware Team
0 Kudos
Message 2 of 5
(8,191 Views)
Hi,

I have the same problem with my application when I want to read a analog Input on my USB 6009 module. (divide by zero error).

Can you answer me if this solution is good AB42??

Thank you in advance of your help

Best regards
0 Kudos
Message 3 of 5
(8,101 Views)
Hi,

I just try to implemente on my code a delay between the read function and the continuation of my code and I have always the same Error (Divide by zero).

TaskHandle  InputAnalogHandle=0;

float64      value=0,ValTensMin,ValTensMax;
int32        ConfigPort;

DAQmxCreateTask("",&InputAnalogHandle);

DAQmxCreateAIVoltageChan(InputAnalogHandle,AIPort,"",ConfigPort,ValTensMin,ValTensMax,DAQmx_Val_Volts,NULL);

DAQmxStartTask(InputAnalogHandle);

Sleep(1000);

DAQmxReadAnalogScalarF64(InputAnalogHandle,10.0,&value,0);

Sleep(1000);

Edit1->Text = value;

If somebody had an idea to resolve this problem, Thank you to take time for help me,

Thank in advance,

Best regards
0 Kudos
Message 4 of 5
(8,092 Views)
Hi,

I have just New since National Instrument about the error using DAQmxReadAnalogScalarF64 ( Error Divide by zero).

He explain me they know this problem and the solution is to install the new NIDAQmx Version 8.0 for Windows 2000/NT/XP :

http://digital.ni.com/softlib.nsf/websearch/4C9E45F6EE5C29F98625708900712CBC

I'm doing the download and try after,

I'm inform you, if this solution resolve the problem to read Analog Input with USB 6009 Module.

Best regards
0 Kudos
Message 5 of 5
(8,082 Views)