Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Running PCI-6509 with .NET

I try to work with  PCI-6509 on Visual Studio 2017 (C#).

First I include dll's into a project.



Then in the code

using NationalInstruments.DAQmx;

private NationalInstruments.DAQmx.Task daqmx_task;
private DigitalSingleChannelReader digital_reader;

 private void ScriptManager_Shown(object sender, EventArgs e)
                daqmx_task = new NationalInstruments.DAQmx.Task();
string[] channels = DaqSystem.Local.GetPhysicalChannels(PhysicalChannelTypes.DILine, PhysicalChannelAccess.External); daqmx_task.DIChannels.CreateChannel(channels[0], "myChannel", ChannelLineGrouping.OneChannelForAllLines);
digital_reader = new DigitalSingleChannelReader(daqmx_task.Stream); // Configure digital change detection timing daqmx_task.Timing.ConfigureChangeDetection(null, channels[0], SampleQuantityMode.ContinuousSamples, 1000); // Add the digital change detection event handler // Use SynchronizeCallbacks to specify that the object // marshals callbacks across threads appropriately. daqmx_task.SynchronizeCallbacks = true; daqmx_task.DigitalChangeDetection += new DigitalChangeDetectionEventHandler(myTask_DigitalChangeDetection); // Start the task daqmx_task.Start(); } catch (Exception ex) { MessageBox.Show(ex.Message); daqmx_task.Dispose(); } }

The code compiles OK. But when I run it crushes with the exception

Could not load file or assembly 'NationalInstruments.DAQmx.dll' or one of its dependencies.


I suspect the dll is not compatible with the .NET framework (V 4.6.1) I compile the project.

Where can I find dll for .NET 4.6.1 ?

0 Kudos
Message 1 of 2

Hi John,



In this link (DAQmx 17.6 readme) you can find the information regarding the support for Microsoft Visual Studio. DAQmx 17.6 is the latest version of DAQmx and you can see there that the latest version of the .NET framework supported is version 4.5.1
(Visual C# .NET and Visual Basic .NET). Version 4.6.1 is still not listed as one of the supported languages.


I think that is the cause of your problem.

0 Kudos
Message 2 of 2