Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-4065 doesn't recognize by c# application

Solved!
Go to solution

Hi,

I'am new user. I'm devoloping an application with  two instruments: usb-6509 and usb-4065. 

1) I have no problem with usb-6509. Perfect.

 

2) I have problems with usb-4065. Installation, driver and dll are ok. I work fine by Measurement & Automation Explorer. My application doesn't recognize the AI channel because when I debug this line of my code: 

 string[] channels = DaqSystem.Local.GetPhysicalChannels(PhysicalChannelTypes.AI, PhysicalChannelAccess.External);

returns array[0], and so when I debug:

 myAIChannel = analogInTask.AIChannels.CreateVoltageChannel("Dev2/ai0","",AITerminalConfiguration.Differential,
                                                             0,10,AIVoltageUnits.Volts);

I have an exception.

 

I don't understand. Can you help me?

Thanks in advance

0 Kudos
Message 1 of 9
(5,039 Views)

The USB-4065 uses the NI-DMM API, not the NI-DAQmx API.

 

NI-DMM 16.0

NI-DMM .NET Class Library 15.2

Tobias
Principal Software Engineer
Driver Software
National Instruments
0 Kudos
Message 2 of 9
(5,034 Views)

Thank you Tobias for prompt reply. 

Now, I'm downloading the packets. 

What must I do after this step?? I explain you. I referenced on my application two .dll files to work with usb-6509:

NationalInstruments.Common.dll and NationalInstruments.DAQmx.dll .

 

Will I have to reference other .dll? Have you got a simple example to work with usb-4065? 

Thanks in advance

0 Kudos
Message 3 of 9
(5,011 Views)

Yes, you will need to reference the DMM assembly.

 

The NI-DMM .NET installer will install multiple examples which you can reference. They will be installed to (assuming Windows 7+)

C:\Users\Public\Documents\National Instruments\NI-DMM\examples\DotNET 4.0\

Tobias
Principal Software Engineer
Driver Software
National Instruments
0 Kudos
Message 4 of 9
(4,993 Views)

Thank you Tobias for reply.
I'm working with .NET 3.5 Framework.
I see 3.5 Framework DMM examples in following directory: C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET3.5\Analog In\Measure Voltage and I debug my same errors.

 

Is  the .NET 4.0 Framework the solution?

 

Thanks in advance.

0 Kudos
Message 5 of 9
(4,979 Views)

What exception are you seeing? Without that information this will be very difficult to debug.

 

What DMM examples are in the directory you linked? I would not expect to see any DMM examples in the NI-DAQ folder since they are unrelated products.

 

The NI-DMM examples do require .NET 4.0.

Tobias
Principal Software Engineer
Driver Software
National Instruments
0 Kudos
Message 6 of 9
(4,960 Views)

Hi Tobias,

I'm using wrapper niDMM.cs to resolve all my problems.

I developed a simpe that read voltage. Now I have another problem.

If I attach current too, my application doesn't read correctly.

 

 

Can you help me???

Thanks

0 Kudos
Message 7 of 9
(4,956 Views)

however, I have my same errors with examples in folder: 

C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET3.5\Analog In\Measure Voltage

errorForum.png

 

The application doesn't recognize the channel Dev1/ai0 (same problem with Dev1/ai1), instead it's all ok by NI MAX application.

 

Now, I read fine the voltage (I pass to init function Dev1) by wrapper niDMM.cs. 

I have problems (see previous post) if I read voltage and concurrently.

 

I hope that all is clear.

Thanks.

0 Kudos
Message 8 of 9
(4,952 Views)
Solution
Accepted by topic author SimoneMarchettiEDA

Could you please post a snippet of your code?

 

NI-DMM devices are not accessed like NI-DAQmx devices are, so I'd like to see that you're using the DMM functions instead. That error looks to be coming from NI-DAQmx calls, which won't work for any DMMs. I assume that "Dev1" is your USB-4065?

 

Additionally, DMMs cannot read both Voltage and Current simultaneously. They can only read one or the other at a time, and to switch between them requires additional calls to change between state.


This link may help with some basics, although it contains a lot of information: http://www.ni.com/tutorial/3297/en/#toc1 

Tobias
Principal Software Engineer
Driver Software
National Instruments
0 Kudos
Message 9 of 9
(4,949 Views)