We need to work in VB.NET 2003 on the USB-6008. We already have a examples in C# for how to read and output Analog voltage...
We need the following example in VB.NET (not C#). Knowing that we included NIdaqmxbase.h
Thank you.
// Task parameters
int error = 0;
TaskHandle taskHandle = 0;
// Channel parameters
string chan = "Dev1/ai0";
double min = -10.0;
double max = 10.0;
// Timing parameters
System.UInt32 samplesPerChan = 1;
// Data read parameters
double data;
int pointsToRead = 1;
int pointsRead;
double timeout = 1.0;
System.UInt32 reserved;
// the original code made several references to constants that were defined
// in the NIDAQmxBase.h header file. Since we can't use the C header file
// in .NET programming, I had to find the needed values in the header file
// and define them here in the program (below)
int DAQmx_Val_Cfg_Default = -1; // Default
int DAQmx_Val_Volts = 10348; // Volts
System.UInt32 DAQmx_Val_GroupByChannel = 0; // Group by Channel
error = DAQmxBaseCreateTask("", out taskHandle);
error = DAQmxBaseCreateAIVoltageChan(taskHandle,chan,"",DAQmx_Val_Cfg_Default,min,max,DAQmx_Val_Volts,null);
error = DAQmxBaseStartTask(taskHandle);
error = DAQmxBaseReadAnalogF64(taskHandle,pointsToRead,timeout,DAQmx_Val_GroupByChannel,out data,samplesPerChan,out pointsRead, out reserved);
error = DAQmxBaseStopTask(taskHandle);
error = DAQmxBaseClearTask(taskHandle);
textBox4.Text = Convert.ToString(data);