09-05-2024 05:31 AM
Hi,
Attached is a simple VI which is used to transmit the string 'Read' through the PC serial port & receive a 20 byte string in response.The Rx lamp indicates healthy communication.
I am using a USB to serial converter which sometimes latches up. Then the VI has to restarted to start communication once again.
I need to find a way to programmatically restart the VI in case of serial communication failure.
Can anyone give any ideas?
I am using LabVIEW 2015.
Thanks in advance.
09-05-2024 05:47 AM
Hi shantanu,
shantanu@india wrote:I need to find a way to programmatically restart the VI in case of serial communication failure.
Can anyone give any ideas?
Idea:
09-05-2024 06:10 AM
Thanks GerdW.
Then I need to have the VISA close VI, error handler VI & the VISA initialization VI inside the while loop isn't it?
09-05-2024 06:12 AM
Is there any way to programmatically restart the VI using state machine ?
I am not very familiar with state machines but I have read that it can be used under similar situations.
I'll try out your suggested method though.
09-05-2024 08:49 AM
shantanu@india wrote:
Is there any way to programmatically restart the VI using state machine ?
Yes, a State Machine is exactly what you need here. The basic idea is that you have specific states that do a single job. For example, you may have "Initialize Port", "Read", "Error", "Close", and "Exit". If the Read state detects an error, it should set the next state to run to be Close which will then set the next state to Initialize Port. It is all about setting what to do next depending on whatever factors are involved.
09-05-2024 08:53 AM
Thanks.
I'll try to write it using state machines & post it here for your comments.
09-05-2024 09:28 AM - edited 09-05-2024 09:35 AM
shantanu@india wrote:
I am using a USB to serial converter which sometimes latches up.
That USB to Serial converter doesn't happen to have a Prolific chipset in it? Years ago the market was flooded with USB-Serial adaptors made with counterfeit chipsets. Prolific released new drivers that could detect the counterfeits and disable them, which makes them appear to randomly lock up. No error is thrown by the Prolific driver, you just get a VISA timeout.
09-05-2024 10:29 AM
I am using ATC-820
09-05-2024 10:43 AM
shantanu@india wrote:
I am using ATC-820
The web page says they use FTDI chipset so it's probably not that.
09-13-2024 04:29 AM
Hi,
I tried for a few days to develop a bulletproof state machine code but for the time being dedcided to use a Ethernet-to-RS485 converter to tide over the immediate issue of the USB-to-serial converter dropping off service in Windows.
Shall definitely rewrite using state machines to enrich my knowledge.