I try to work with PCI-6509 on Visual Studio 2017 (C#).
First I include dll's into a project.
NationalInstruments.DAQmx.dll
NationalInstruments.Common.dll
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)
{
try
{
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 ?