VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Read VeriStand Channel from inside Custom Device that are not part of Custom Device?

Solved!
Go to solution

Is it possible to read VeriStand channels from inside a VeriStand custom device (RT Driver) that are not part of that Custom Device?

 

Say for example that I want to be able to setup a channel in my custom device to always be double the value of a hardware channel that my user selects (I know, better/simpler ways to do this, but it's just a simple example Smiley Tongue).  Can I do this from the custom device without programmatically creating a system mapping? (I've done this before and it's messy and VERY prone to user error).

 

Thank you!

Chris
Project Engineer
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 1 of 11
(7,112 Views)
Yes you can do this in an inline custom device. Use the navigation VIs to navigate to the channel(s) you are interested in, then open up channel data references to read the channel value
Stephen B
0 Kudos
Message 2 of 11
(7,103 Views)

As an example you can refer to the old source for the Embedded Data Logger. The code has changed a bit since it was incorporated into VeriStand, but it used to be an add-on. You can find the source here.

Jarrod S.
National Instruments
0 Kudos
Message 3 of 11
(7,087 Views)

Awesome!  Thank you both for your replies.

 

I seem to remember in the past having trouble because the system definition seemed to be recompiled such that the paths to channels stored during configuration changed in the executing environment.

 

Is this not the case anymore (or was it never the case)?

Chris
Project Engineer
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 4 of 11
(7,082 Views)
Solution
Accepted by topic author Call_Me_Vinny

good point

 

the channel IDs (the U64s) aren't the same in config vs engine. Instead you should set 'dependent item references' in config and then get those references in the engine.

 

See the source jarrod linked, that does this

Stephen B
0 Kudos
Message 5 of 11
(7,079 Views)

Ah Ha!  There's the piece I was missing!

 

Thanks Stephen!

Chris
Project Engineer
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 6 of 11
(7,076 Views)

***NOTE***

 

This is still the referenced code, but the method that Stephen posted below should be used instead.

 

************

 

 

For posterity's sake, here's the relevant code that's been referenced:

 

From the configuration saving (Windows side):

GetPathbyRef.png

 

And the RT Driver side:

 

GetRefByPath.png

Chris
Project Engineer
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 7 of 11
(7,073 Views)

Actually, I forgot, NIVS 2009 (which that code is based on) did not include the 'dependent item' property type. So the code you posted above and the code jarrod referenced are not best practice anymore. I'll post a snippit of what you should do in just a second.

Stephen B
Message 8 of 11
(7,067 Views)

Do this! (not what was posted above)

 

Capture.PNG

 

And then you can just open data references to that item

Stephen B
Message 9 of 11
(7,064 Views)

Awesome! Thanks Again!

Chris
Project Engineer
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 10 of 11
(7,062 Views)