Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Restarting serial communication after disruption

Hi,

I am using a USB to serial converter to communicate to a PLC inside a while structure.

I am configuring the serial port before entering the loop.

The communication is fine...there is no issue with that.

Now whenever I unplug my USB-to-serial device the loop continues to execute unless I use the 'STOP' button to forcibly stop the loop. Only after the loop stops executing , the error dialog box is thrown.

Can anybody guide me in modifying my program to the achieve the following:

  1. The while loop exits as soon as the USB-to-serial converter is unplugged.
  2. Any means of restarting the VI after restoring the USB-to-serial converter.

Thanks in advance.

0 Kudos
Message 1 of 5
(4,330 Views)

Hi,

I have used the unbundle function to read the error status & exit the while loop.

Attaching the edited version.

But my second issue is still unsolved.

0 Kudos
Message 2 of 5
(4,323 Views)

Put another While loop around all of your code.  Have it stop when you press the stop button.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 5
(4,321 Views)

Hi,

Thanks.

The while loop around the code works fine , but the outer stop button does not stop the execution.

I have to press the outer stop button then the inner stop button & then the outer stop buttoon once again to exit from the program.

0 Kudos
Message 4 of 5
(4,317 Views)

Hi,

Only one stop button in the inner while loop does the trick....

0 Kudos
Message 5 of 5
(4,306 Views)