From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW HSDIO active channels property equivalent in C#

Solved!
Go to solution

Is there a C# equavalent  of LabVIEW HSDIO active channels set/get property. I have looked into the latest version of the HSDIO C# wrapper and I could not find the property enum nor the property constant for use with SetString() method.

 

0 Kudos
Message 1 of 5
(4,535 Views)
Solution
Accepted by raffythegreat

@raffythegreat wrote:

Is there a C# equavalent  of LabVIEW HSDIO active channels set/get property. I have looked into the latest version of the HSDIO C# wrapper and I could not find the property enum nor the property constant for use with SetString() method.

 


You may get better luck asking in the DIO hardware forum.

 

I took at the latest wrapper http://www.ni.com/product-documentation/52900/en/  and there doesn't see to be the method you seek.

Message 2 of 5
(4,529 Views)

There are major regressions in the 14.0 HSDIO C# driver wrapper compared to the previous 1.90 version. Get/SetAttribute functions aren't even exposed publicly! Try programming any realistic HSDIO scenario without those; even the cookie-cutter examples need them. I have reported many of these problems and received CARs, but NI support doesn't seem to think they need to be fixed because the user can "work around" them by modifying the wrapper file on his/her own. Never mind the fact that the NI provided examples won't even run with the driver as provided!

 

I offered to share the work I did in cleaning up the 14.0 C# wrapper, but this offer was turned down. My work includes fixing the broken IDIsposable patterns, fixing XML comment documentation so that VS intellisense works, etc. I may post it here for others when I get a chance. I will also look up the equivalent integer for the missing "ActiveChannels" property, this should be somewhere in the C header files.

 

The stance that is being taken here by NI truly baffles me. I get that Measurement Studio is not NI's favored child, but we are talking a 2-3 days worth of one engineers time to just clean up the stupid wrapper. Less by working off the base I'm willing to provide. Last time I checked, VS2015 reports around 400 .NET Framework static rule violations in that one file, most of which are very basic and simple to fix. Why NI would ship such a low quality product, even for the unloved Measurement Studio, is beyond me.

 

Edit, here are the problems I reported to NI Support back in March 2015:

Set/Get property functions not in the public wrapper class (they do exist in the PInvoke class, but this is private and not available to outside code.)


All of the STPMU functions are missing the XML summary/param/return
documentation. But if you go back to 1.9 or 1.8 all that documentation is there
in the file.


The set/get attribute methods are not
the only methods that exist in the private PInvoke class but aren't exposed in
the public class. Also look at the trigger functions, e.g.
ConfigureSoftwareStopTrigger. Some of these are publicly exposed and some
aren't.
The missing trigger functions:
public static extern int ConfigureDigitalEdgeStopTrigger(System.IntPtr
Instrument_Handle, string Source, int Edge);
public static extern int ConfigureSoftwareStopTrigger(System.IntPtr
Instrument_Handle);
public static extern int DisableStopTrigger(System.IntPtr Instrument_Handle);

 

The 1.8 driver, very helpfully, includes what the associated attribute
type is for each field in the niHSDIOProperties enum.
The 2.0 driver just says "System.Int" for every single one. I don't think the
point of this documentation was to describe what the type of the enum field is,
but rather what Get/Set Attribute function you would use to access the given
property. Of course every field in that enum is the same Int32 type. I don't
need the documentation to tell me that!
An example from 1.8:
        /// <summary>
        /// System.String
        /// </summary>
        DynamicChannels = 1150002,

This tells me that I need to use a version of SetString(...) to get or set this
property

An example from 2.0:
        /// <summary>
        /// System.int
        /// </summary>
        DynamicChannels = 1150002,
This doesn't tell me anything. I have to look up the external HSDIO
documentation to find out what type is associated with this property, and
therefore what function to use.

0 Kudos
Message 3 of 5
(4,252 Views)

Sorry to hijack the thread with my previous response. Here is what I found in the niHSDIO.h C Header file:

 

 

/* Base attributes */
#define NIHSDIO_ATTR_DYNAMIC_CHANNELS                        (IVI_SPECIFIC_PUBLIC_ATTR_BASE + 2L)    /* ViString */
#define NIHSDIO_ATTR_STATIC_CHANNELS                         (IVI_SPECIFIC_PUBLIC_ATTR_BASE + 3L)    /* ViString */

 

So there doesn't appear to be an attribute for Active Channels. Maybe it is just these two values added together?

 

0 Kudos
Message 4 of 5
(4,224 Views)

The "Active Channels" property is used in LabVIEW to specify which channels' properties will be modified within a task. It isn't a list of the channels being used. In text based implementations of NI-HSDIO, there is no Active Channels property to set as each function that modifies channel properties has a "channels" input. You can see this by comparing the "Dynamic Gen and Acq" example as it is written for LabVIEW, LabWindows/CVI, and C# in Measurement Studio. 

 

Hope this helps clarify things.

 

-Eric H.

Eric H.
Senior Field Applications Engineer
NI
Message 5 of 5
(4,204 Views)