From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Switch Hardware and Software

cancel
Showing results for 
Search instead for 
Did you mean: 

Why I got an error when I continually change channel connection on PXI2530

I use 2530 as a 4x32 matrix. It works well when I use initilize vi -> make channel connect vi and close vi . But when I put make channel connect vi into a loop and change the channel in every loop, it output " the session is not valid " error. the channels are not duplicate in every loop, they can connect well in Switch Front Panel. So what's wrong? need I disconnect before  make new connection?
Message 1 of 4
(6,927 Views)

If I understand your application correctly, you are opening and closing niSwitch session for every connect you want to make. Please try to limit opening and closing of a session to once per application. Doing so will save you significant amount of time as the initialization is not an inexpensive operation time-wise.

Another benefit from using a single session is that errors like the one you've got (invalid session) should be rare and far apart.

 

If what you're doing is a single open/close session, and you only loop on switch connects, then yes, you will have to perform a disconnect operation before trying to make the new connection between the same two channels.*

 

 

 Hope this helps!

 

best regards, 

 

-Serge

 

* this of course depends on the topology. In general, matrices will allow more than one connection to a row or a column (but still the endpoints must not be the same), while muxes will not. There are no implicit disconnects in a switch session.

Message Edited by Srđan Zirojević on 09-28-2009 08:23 AM
Message Edited by Srđan Zirojević on 09-28-2009 08:24 AM
Message 2 of 4
(6,919 Views)
yes, I only open and close the session once  in application, the error occur in second loop. my vi is basicly same with example, I just put the connect vi into a loop, but it can't work well, it's very strange, I will check other parts of my application, maybe the error is from other part of my vi.  thank you very much. 
0 Kudos
Message 3 of 4
(6,911 Views)
Can you post a small code snippet or picture of your code?  Perhaps this is one of those things that's easier to debug if we can see how your code is running.
0 Kudos
Message 4 of 4
(6,903 Views)