01-11-2016 12:38 PM
I have a VI that is implemented as a state machine. I attempt to preserve a reference to one XNET "out" session and one XNET "in" session with one global variable for each. I am getting an error:-1074384740. I believe it is related and it only occurs when I call xnet write in the Run state. The sessions are acquired in the Init state.
Is it possible to use globals to preserve references to XNET sessions?
01-11-2016 12:39 PM
BTW, I am using LabVIEW...
01-11-2016 01:06 PM - edited 01-11-2016 01:07 PM
swbpnole wrote:Is it possible to use globals to preserve references to XNET sessions?
Technically? Yes this is possible. Practically? Well you probably shouldn't do this. You are putting a reference to hardware in a place that can be overwritten, closed, read, and manipulated without control, or having any reasonable way of finding where changes are being made. I'd suggest a design where you have some kind of read-only access, or have some kind of control over who gets to do what with the reference. Some say the answer is classes, some would say a VI wrapping the reference into a read is enough, and some might suggest a VIG where you can have methods that do things on the reference in a way that is a little easier to track. Post your code if you can.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
01-11-2016 01:51 PM
Picture attached.
01-12-2016 07:28 AM
That being said that snippet is not the most useful, but what is is the whole application, seeing where else you read and write that global, and where references are closed.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord