Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Seesion ID lost during write function

I am having an issue with the session ID getting lost at random times.  Sometimes it disappears right when entering the subvi, other times after a property node, this time shown in my attachment is during the 'Write' function.  I am trying to talk RS485 to an ICP CON module (I-7063) via the Ethernet port and an Ethernet to RS485 converter module (ICP CON 7188E8D).  This happens on my desktop PC using a USB 3.0 to Ethernet adapter and with an embedded PXIe controller connected directly to the ethernet port.  Most times it runs as it is supposed to but if you wait long enough (about a minute of retires), it will fail at a random location.  When it happens during the Write function, the Read function doesn't have a session to get data from so the code following will error.  Any thoughts as to why this may be happening? 

LV 2012 SP1

Windows7

0 Kudos
Message 1 of 8
(4,427 Views)

Trouble,

When using VISA functions, it is typically all done in the same portion of code, the flow being the basic open >> configure >> read/write >> close functions all being in the same VI, whether it is a subVI or main.  How are you programming this in your code?

Wayne T. | Application Engineer | National Instruments
0 Kudos
Message 2 of 8
(4,382 Views)

In this particular case, the clear-buffer/write/read is in a subVI.  The open/configure and close are just one level up.

0 Kudos
Message 3 of 8
(4,377 Views)

Trouble,

 

That very well could be the issue, then.  Is there any particular reason they can't be at the same level?  For every single time you open the resource, you want to close it before attempting to access again (or have another routine attempt to access).  

Wayne T. | Application Engineer | National Instruments
0 Kudos
Message 4 of 8
(4,349 Views)
Typically, the open/close is NOT at the same level. An open is never required and you would do a configure and close only once in the top level.
0 Kudos
Message 5 of 8
(4,340 Views)
Loosing a session ID, in calling a function. Are you using locals when calling that function?
greetings from the Netherlands
0 Kudos
Message 6 of 8
(4,321 Views)

Nope, no variables in this application, everything is wired.

0 Kudos
Message 7 of 8
(4,314 Views)
Then it may be a for loop where you don't use shiftregister for the visa resource.
No problem except when the for loop executes zero times.
greetings from the Netherlands
0 Kudos
Message 8 of 8
(4,304 Views)