Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

how do i setup visual c++ 2008 to use measurement studio tools and NI-9401 digital inputs?

Also, the ActiveX controls are only a subset of the available .NET tools.  So if I need a gauge control I need to program in VB, C# etc?  I tried creating a Win32 C++ app, added a dialog to it, but the .NET controls are still grayed out.

Is NI support of C++ not as complete as the support for VB etc?

 

0 Kudos
Message 11 of 25
(5,605 Views)
Hi edp3,

Yes, your observation is correct in that the we do offer more controls, features, and functionality in our .NET components for use in a .NET-compliant language such as C# and VB.NET.  This is the direction that Microsoft is moving towards and so we are devoting our resources in this direction as well. We will continue to support our C++ and ActiveX UI controls, libraries, etc, but no new development is being done on them.  So if you are wanting new features, then I would suggest you move to C# or VB.NET.

With regards to reasons for use our wrappers instead, this is discussed in the following documents:

Compile Errors with Measurement Studio ActiveX Controls in Visual C++
Loading Measurement Studio ActiveX Controls into Visual C++ 6.0

Towards the ends of both documents, we discuss the wrappers.

Best Regards,
Jonathan N.
National Instruments
0 Kudos
Message 12 of 25
(5,602 Views)

Thanks. I will be moving to C#.

 

0 Kudos
Message 13 of 25
(5,601 Views)
I'd like to elaborate on Jonathan's statement that we are not doing any new development on the ActiveX controls and C++ libraries. This is true for eveything except DAQmx.
 
We are continuing to add new features to the Measurement Studio DAQmx C++/MFC class library and have no plans to stop doing so. However, we do not currently plan to create a 64-bit version of this library (or any of the Measurment Studio C++ libraries). There are plans to create an 64-bit ANSI C API; we expect customers writing 64-bit C++ DAQ applications to use the ANSI C API.
 
If anyone out there wants or needs 64-bit versions of the Measurement Studio C++ libraries, please let us know.
 
David Rohacek
National Instruments
0 Kudos
Message 14 of 25
(5,591 Views)

I need to capture negative going edges on a digital input from a NI-9401.  The application will be in C#.  Is there an example I can look at that handles an event of this type.  I have done plenty of VC++ MFC code, but I need an example of how C# is constructed to do this.  Thanks.

 

0 Kudos
Message 15 of 25
(5,579 Views)
Hello,

There are a good number of digital read examples for C# that can be found at C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0\Digital\Read Values   (assuming you did the default installation). 

NickB
National Instruments
Applications Engineering
0 Kudos
Message 16 of 25
(5,559 Views)

Thanks, I found the examples.  Another dumb question if I may. I am getting a runtime error saying:

Additional information: Measurements: Device identifier is invalid.

Device Specified: Dev0

The line causing it is:

myTask.DIChannels.CreateChannel(

"Dev0/port0/line0", "MeterInput", ChannelLineGrouping.OneChannelForEachLine);

I have a NI-9401 plugged into the first slot in a cDAQ-9172.

What am I doing wrong?  The line is preceeded with:

myTask = new Task("FlowMeter");

 

Thanks

 

0 Kudos
Message 17 of 25
(5,555 Views)
Hello,

This error occurs because Dev0 does not correspond to your cDAQ.  To find what does correspond to your cDAQ, you can open Measurement and Automation Explorer, and view the devices under the DAQmx devices tree.  I would guess that your cDAQ module should instead be referenced like this:

cDAQ1Mod1/port0/line0

but once again, this is dependant upon your hardware configuration.  The best way to make sure you are addressing the right piece of hardware it to double check in MAX. 

NickB
National Instruments
Applications Engineering
0 Kudos
Message 18 of 25
(5,551 Views)

Thanks it is nice to see something working!

I am wanting to capture falling edges on a digital input. I have setup, I think, an event handler to catch these negative edges like so:

 

private string MeterInput = "Channel 0";

...

Meter =

new Task("FlowMeter");

Meter.DIChannels.CreateChannel(

"cDAQ1Mod1/port0/line0", MeterInput, ChannelLineGrouping.OneChannelForEachLine);

Meter.Timing.ChangeDetectionDIFallingEdgePhysicalChannels = MeterInput;

Meter.DigitalChangeDetection +=

new DigitalChangeDetectionEventHandler(Meter_Pulse);

SCR =

new DigitalSingleChannelReader(Meter.Stream);

Meter.Start();

...

private void Meter_Pulse(object sender, DigitalChangeDetectionEventArgs e)

{

}

Is there a time stamp that I can query within Meter_Pulse?

Also is there a functional description of NI-9401's C# interface?  I am getting Measurement Studio 2005 help about member functions, but it is a backward way to get an understanding of the programming structure. Sorry about such a question, but I have jumped into the deep end and I am trying to get up to speed as quick as possible.

Thanks

 

0 Kudos
Message 19 of 25
(5,547 Views)
We do have conceptual content that is designed to help you understand the .NET interface to DAQmx. Open up the Table of Contents in the same help file in which you found the reference topics and go to NI Measurement Studio Help>>NI Measurement Studio .NET Class Library>>Using the Measurement Studio .NET Class Libraries>>Using the Measurement Studio NI-DAQmx .NET Library. (Alternatively, this link should work: ms-help://NI.MeasurementStudio.2005/NINETDAQmxConcept/XML/Using_NINETDAQmx.html).
 
This is the overview topic for the documentation that explains the major concepts in the .NET DAQmx API. If this is not the type of documentation you are looking for or if it is inadequate, please let us know what's missing.
 
David Rohacek
National Instruments


Message Edited by drohacek on 04-23-2008 09:18 AM
0 Kudos
Message 20 of 25
(5,538 Views)