Showing results for 
Search instead for 
Did you mean: 

Changing VISA resource at Run time



I would like to change VISA resource(COM port) at run time. I sort of did it but it's causing problems like VISA error like 1073807343. But it works on alternate runs. My computer also crashes more with blue screen after implementing. Perhaps I am not doing it right, so please have a look at my code.


Download All
0 Kudos
Message 1 of 4

You have a subVI that you didn't include that appears to initialize the serial port.  What goes on inside of it?


Why do you have a shift register for your VISA resource?  You never use a value out of it on the left side, but are always rereading from the VISA resource control.


If you change the VISA com control, it will get read on your next iteration of the queued state machine, but you never issue a command to reinitialize the serial port.

0 Kudos
Message 2 of 4

Just the VISA configure serial Port is insie the VI.

Previously the VISA source was outside the while loop and I used the shift register to pass the refnum to other cases. Now i wonder why I have it and I am reaing from source every time..bad idea..


How do I edit this?

May be create a event for VISA control and make it go to initialize state everytime it is changed?

How do I deal with reading from VISA control everytime

0 Kudos
Message 3 of 4

Hello GoKu25,


normally all controls should be acquired with the event structure. Use a cluster with a variant and the enum inside for transfering the values over the queue, then you can transfer the changed values from the producer loop to the consumer loop and reintialize the serial port. Addtionally you can remove the wait until next in the event structure (producer), because your programm runs event driven in this while loop.

best regards
0 Kudos
Message 4 of 4