06-03-2013 10:25 AM
I'm still a little hesitant about events in LabVIEW using data coming in (not user events, mouse click, keyboard, etc.). When I'm looking for an async serial stream to start coming in, I currently use the upper loop in the attached VI (38.4 KB, hex string in, the "stop loop control" is actually set from the serial bytes coming in - a 2-byte terminator) and it works fine, getting the whole string I need. It's polling the port every 1 ms until something comes in.
Would the lower loop give me the same functionality without doing this continuous polling, or would it actually do something different? If I were to use this one instead, am I blocked from writing to the same port in another part of the code until I get some data in and the while loop stops, or is there some way to barge in and then start looking for data again?
Cameron
06-03-2013 10:29 AM
You can write to the same serial port in other parts of your code.
I have never used serial events before, so I don't know if there are any oddities to it.
In both examples, I would use the bytes at port to read all the bytes at the port that are available at that moment and concatenate them to the string rather than just one.
06-03-2013 10:38 AM
@RavensFan wrote:
In both examples, I would use the bytes at port to read all the bytes at the port that are available at that moment and concatenate them to the string rather than just one.
I'm only reading one byte at a time because of the way I have to determine the stop situation (because of dealing with other, older, inherited code), although, looking at that part of the code, I might be able to remove that here and do single-byte checking down the line. I know it slows me up a bit, sl I'll check that out.
Cameron
(Steelers Fan)