06-26-2012 02:51 PM
Hi folks,
Still new to LabView, so please bear with me...
I have a VI that sits and wait for a certain character string to arrive over the serial port, but I need a timeout that doesn't rely on the VISA timeout.
I expect a bunch of text through the serial port for ~45 seconds, then my input string will compare the matching string and move on to the next VI.
In the event of no string match, the serial port may keep on sending serial data, or may be inactive (non-determinisitic because this test is to see if a computer system booted correctly). But once the VI starts, I should have 60 seconds to find the match, or set the bool output 'selection' to fail.
I have tried putting my Elapsed Time loop inside the main loop, outside, with/without SRs, and now I'm at a loss. I looked at the VI highlighted and the serial activity wasn't active until the 60 second timer expired.
Please take a look at the attached, and thanks for taking a look at this post.
Solved! Go to Solution.
06-26-2012 03:21 PM
I'm not entirely certain that I understand what you are trying to accomplish. However here are my thoughts:
Thanks,
Charles Chickering
06-26-2012 03:41 PM
Thanks Charles,
To answer/comment on your thoughts:
1. I want the serial port for waiting bytes to continually loop while the 60 sec timeout is running.
2. All the setup is in a main VI and is working properly
3. This helps a lot - runs great.
The updated VI will always run for 60 seconds. Say I got my string match 35 seconds in - the program won't end until this timer is expired. Can I do that using the express VI, or shall I make a case structure for this instance?
06-26-2012 03:50 PM
The boolean coming out of your "Match True/False String" primitive will stop the code if true. So the logic for the stop condition is as follows:
Perhaps we need to rework the Match True/False String part of the code?
Charles
06-26-2012 03:52 PM
You are not reading the code correctly. The VI will stop when the string is found, the time is up, or when the stop button is clicked. No changes are required.
06-26-2012 03:57 PM - edited 06-26-2012 03:57 PM
Perhaps this is caused by doing a segmented read of the serial port? (meaining not all of the data comes in one read). Check out the attached VI, I added a shift register to keep the entire received data in a buffer.
Charles
06-27-2012 07:58 AM
Thanks for all the help Charles and Dennis. It turns out I was reading it incorrectly. I am going to test out the SR addition to the serial string, sounds like a definite improvement to the code.