VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding channels to a Custom Device with .NET APIs

I've been able to add channels to DAQ hardware and Reflective Memory (which work similarly). However, I've not yet grasped the API calls to do the same with a Custom Device. I can drop a "CustomDeviceChannel" constructor and set the properties, but I fail to find any "Add..." API except for the "AddCustomDeviceChannelIfNotFound", but that already has its own "Name" and "GUID" properties, and it does not take as input a new instance of a "CustomDeviceChannel". This diverges from DAQ and Reflective Memory where there are "AddDataChannel" or, e.g.,  "AddAnalogInputChannel" APIs which take in the constructor ref.

 

Does anyone have example code? As a workaround, I dropped in the "NI Veristand - Add Custom Device Channel.vi", but feeding it properties and values doesn't seem to work (I'm trying to set the Description field). I'd still like to know for future reference how to do this strictly with the .NET APIs.

Download All
0 Kudos
Message 1 of 4
(2,848 Views)

Hi,

 

I've looked into the CustomDeviceChannel API a bit and also saw that adding a new channel is not an option via that constructor. I am looking into this more to find a way to do it with .NET API. However, I was curious what issues you were running into using the Add Custom Device Channel VI. Let me know what issues you're running into so we can hopefully find a useful workaround at the very least.

 

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(2,800 Views)

When calling the "NI Veristand - Add Custom Device Channel" vi, you have the option of setting item properties on the channel with an item "name" array and item "value" array. Using the name "Description" for example, did not appear to add the string value to the given channel "Description" field. The field was still blank when I looked at the new SDF.

0 Kudos
Message 3 of 4
(2,795 Views)

First, have you used NI VeriStand - Get Item Property VI to look at the properties of the custom device channels? This should generate an array of each property available. This way we can tell if Description is a valid property, and ensure it is capitalized properly, as properties are case sensitive.

 

To go back to the original question, after I've had some time to dig into it, it makes sense that adding a channel is not a method available to CustomDeviceChannel constructor nodes. This is because the constructor node needs a way to point back to the custom device you're adding a channel to. Instead, you're on the right path in using the CustomDevice constructor node and the AddChannelIfNotFound method. You should be able to change the name that is associated with the new channel. The GUID is a unique idea that should ensure the proper kind of channel is created. Let me know if you run into further issues when adding channels this way.

 

Alex C.

National Instruments

Applications Engineering

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 4 of 4
(2,784 Views)