04-14-2014 06:42 PM
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 ). 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!
Solved! Go to Solution.
04-14-2014 09:05 PM
04-15-2014 09:48 AM
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.
04-15-2014 09:57 AM
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)?
04-15-2014 09:59 AM
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
04-15-2014 10:01 AM
Ah Ha! There's the piece I was missing!
Thanks Stephen!
04-15-2014 10:10 AM - edited 04-15-2014 10:20 AM
***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):
And the RT Driver side:
04-15-2014 10:13 AM
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.
04-15-2014 10:18 AM
Do this! (not what was posted above)
And then you can just open data references to that item
04-15-2014 10:19 AM
Awesome! Thanks Again!