10-16-2014 07:54 PM
I am just trying to understand, so the reference becomes invalid if the calling VI becomes idle eventhough the VIs are still loaded in memory?
10-16-2014 08:14 PM
P@Anand wrote:
I am just trying to understand, so the reference becomes invalid if the calling VI becomes idle eventhough the VIs are still loaded in memory?
Yep. When the full call chain is idle, the references become invalid.
10-16-2014 08:21 PM
Thats a new learning for me, till now I was assuming that as long as the VI is in memory the reference will be valid. In that case what will be the output of the 1st call primitive? Will that be True?
10-16-2014 09:12 PM
Thank you Crossrulz,
Today I learned new concept.
Just to correct myself, If I initialized properly then it will executes properly (if File exists) but how can I get the next states (like read/write/close) without state machine.
As you told, if it is not about next states (State machine) then please ignore this.
10-16-2014 11:05 PM
As Tim already mentioned (and directed) you need to use the AE without a shift register for the states. So you have to call the AE (ini read sub VI) in individual instances to Open, Read, Write and Close seperately.
10-17-2014 02:12 AM
Well, in fact, LV is keeping the memory for the VI as well as the data stored in there. The point is, that the runtime engine obviously frees the resources which are attached to that handle.
As an example (i dont know if this really is comparable, but it is a good 'comparison' for understanding):
You open a session to a serial port (RS232). VISA will request the interface from the OS (as serial ports must be used by 0 or 1 processes at a time, not more). So the OS will lock the RS232 interface for THIS process.
The VISA layer will return a handle to the session to LV which is stored in the wire. Even if LV keeps that handle, it doesn't mean that the VISA layer has to hold the session. So VISA can return the interface to the OS (free).
So even if your VI still has some "valid appearing" handle to the RS232 port, you would receive an error trying to access it unless VISA re-allocates the session using this handle for you.
Yeah, that's some of the weirdness having layered applications. On the other hand, with this approach, resources can be handled in a much more effective way by the drivers/OS.
Norbert