adamLL

Variable in python enviornment to Channel value

Recommended Posts

Is there any good way to get a value from a variable from a python environment into a channel/variable value in DAQFactory?

I am currently using an instrument that will only let me easily read its outputs with python.

My current idea is to have a python script that reads the output from the instrument, and then writes it to a file. Then I would use DAQFactory to read the file in as the channel value.

Share this post


Link to post
Share on other sites

There are probably lots of ways, but the easiest is probably to do what you described and use a file.  Use the File. functions within DAQFactory to read the file.

Share this post


Link to post
Share on other sites

Thanks for the help. When I store this value in a channel, would it be best to use a V: channel or a test channel. I'm a little confused on the difference between those two. 

Share this post


Link to post
Share on other sites

V channels are largely deprecated, so I wouldn't recommend them.  They are left over from when we didn't have variables (like 18 years ago!), but so many people seem to use them that we can't really get rid of them.  I think people like it because you can see the contents in a table?  Other than this, and the fact that assignment to a V channel does the equivalent of AddValue() on a variable, a V channel is basically the same as a global variable.  A channel, however, has added features such as persist, conversions, and other things.  If you are getting an input value from the python script that is basically an I/O point, I would use a Channel.  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now