Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Error with C# Express and GlobalContinuosAI Example

When I run the GlobalContinuousAI example with C# Express I get the error below. I did create a task in MAX first for the USB 6008 unit that I have and it works in MAX. The .net DAQ examples that are in the other folder also do work so I suspect a problem with the task creation or import or similar Does anyone know what might be wrong?
 
Error 1 'NationalInstruments.DAQmx.AnalogMultiChannelReader' does not contain
a definition for 'SynchronizeCallbacks' C:\Program Files\National Instruments\MeasurementStudioVS2005
0 Kudos
Message 1 of 4
(3,538 Views)
Hello LabTech,

I'm not exactly sure what example you are using. What is the actual file name that you are running? It seems like this could be a problem with your configuration, but I would tend to doubt it since the error points to a missing property. SynchronizeCallbacks is a property of NationalInstruments.DAQmx.AnalogMultiChannelRead and should look like this:

public virtual bool SynchronizeCallbacks {get; set;}

Are you calling this function in your code anywhere? Another option that might be important is your hardware configuration. Is your NI USB-6008 configured to use the NI-DAQmx driver? You should be able to determine this because it should be listed under NI-DAQmx Devices in the "Device and Interfaces" category in Measurement & Automation Explorer (MAX). Your task should also be listed as a NI-DAQmx Task in the "Data Neighborhood" section of MAX. Are the device and task listed as such?


Matt Anderson

Hardware Services Marketing Manager
National Instruments
0 Kudos
Message 2 of 4
(3,515 Views)
Hi and thanks for the response.
 
I did get it working, but I still have two questions.
 
The program is the GlobalContinuousAI that is in the Examples/DAQmxwithUI folder. I commented out the following lines and the code worked?
 

//#if NETFX2_0

// reader.SynchronizeCallbacks = true;

//#else

// reader.SynchronizingObject = this;

//#endif

Also, If I run the program in debug mode the waveform graph does not show data, if I start without debugging it does? I should also mention that this is with the C# Express Edition.

0 Kudos
Message 3 of 4
(3,513 Views)
Hello Bryan,

I think the problems you are experiencing stem from the fact that C# Express is not supported by NI-DAQmx. If you view the NI-DAQ 8.5 Readme located here, you will see the following table, which describes API support in NI-DAQmx:

Microsoft Visual Studio Support

The following table lists the programming languages and Microsoft Visual Studio versions supported by NI-DAQmx and Traditional NI-DAQ (Legacy).

Programming Language Visual Studio Versions
 Supported by NI-DAQmx
Visual Studio Versions Supported
 by Traditional NI-DAQ (Legacy)
ANSI C 6.0 and later 6.0 and later
C++ 2003 (7.1)1
Visual Basic 6.0 6.0 SP62 6.0 SP63
.NET Framework 1.1
Languages
(C# and Visual Basic.NET)
2003 (7.1)
.NET Framework 2.0
Languages
(C# and Visual Basic.NET)
2005 (8.0)
1 Requires Measurement Studio 7.x
2 Support through ANSI C type library
3 Support through ActiveX


Following with that idea, it looks like the SynchronizeCallbacks property does not function correctly in C# Express. That would explain why you were receiving an error when you tried to run the example that includes a call to this property; the code works with the changes you made because you commented out the reference to SynchronizeCallbacks. You could consider running the example in release mode, as that might help avoid this error. You can change to release mode by selecting Debug>>Start Without Debugging. I believe this is what you are doing to avoid the problem with the waveform graph, so it might be worth a try in this case as well.
 
In addition to these steps, you may want to look into this example. The example was submitted by a customer and provides a wrapper for NI-DAQmx that should allow access from Visual Basic Express Edition. It lists an earlier version of the NI-DAQmx driver, but it may provide you with a compatibility option.

Matt Anderson

Hardware Services Marketing Manager
National Instruments
0 Kudos
Message 4 of 4
(3,496 Views)