12-20-2012 02:25 AM
I am new-ish/returning amateur user of Labview and I am trying to edit the example VI "Advanced serial write and read VI" that is part of dev suite 2012. I need to use the string box to show ALL text received from serial port, always appending and only rolls off screen when more real data arrives at serial port.
What is actually happening is as more bytes (or no bytes AT ALL!) arrive during read time, current text rolls off the string box. Even when 0 bytes are received, screen is blanked out. I am not very familiar with functions locations and even worse at understanding obscure references to functions, so please keep replies very basic so I can follow.
Just to be clear, I need the string window to behave like hyperterm does-always shows data and it is not pushed out of window arbitrarily.
Thanks,
Steve
Solved! Go to Solution.
12-20-2012 02:41 AM
Hi Steve,
Could you just choose not to update the text indicator if the received serial string is empty? There is a function in the comparison palette for determining if a string is empty or not, then simply use a case structure to write or not write to the text indicator.
-CC
12-20-2012 04:49 AM
What you're asking for isn't that obvious in LabVIEW, or that easy.
There are two ways that I can think of to do this:
1.
Create a local variable for the read string
From the string pallette select the append string
Wire in the output of the local variable and the data read from the Com Port to the append string and output this to the read string. (You may want some formatting symbols such as carriage returns in there)
2.
Create a shift register on the while loop.
Append the read string to the contents of the shift register (again, you may wnat formatting), and put the appended string into the shift register.
Display the appended shift register in the read string indicator.
I'd be inclined to go with the latter, as then you can start limiting the length of the string and gain more control of it in the long run, but the former would do the same job. Neither of these are pretty, or necessarily good code, but should achieve your aim.
12-20-2012 12:17 PM
A long shot.
Is this what u want?
12-20-2012 01:53 PM
Tried this, does not prevent the issue, only prolong it as next valid drop into loop pushes data off screen. Part of the problem is these are timed fetch cycles, the serial data does not arrive dynamically, but rather drops into serial fetch loop and gets "peices" of the data and posts it to screen. For example, I send10000 chars, the fetch reads maybe 500 chars first time, posts to screen, then 400, posts to screen, so-on. Probelm is, the txt is a menu screen, and I need the entire menu screen intact and ON SCREEN. Niether is happening. I also want to parse some of this arriving menu and use voltage values and current for data logging.
12-20-2012 01:54 PM
12-20-2012 01:58 PM
@KathrynB;
I tried the shift register method, seems to yeild same results, only takes longer to push txt off screen.
I dont understand why the txt rolls off screen! It is like there is a CHR/LF coming from the serial function, but I have put at a read #chrs and read hex, there is no content coming from serial fetch function. Seems like such a rudimentary thing to do, if txt is coming asyncronously from any source, why does a phantom CR/LF get pushed?
12-20-2012 02:03 PM
Sorry,
@Chrissy
Tried this, does not prevent the issue, only prolong it as next valid drop into loop pushes data off screen. Part of the problem is these are timed fetch cycles, the serial data does not arrive dynamically, but rather drops into serial fetch loop and gets "peices" of the data and posts it to screen. For example, I send10000 chars, the fetch reads maybe 500 chars first time, posts to screen, then 400, posts to screen, so-on. Probelm is, the txt is a menu screen, and I need the entire menu screen intact and ON SCREEN. Niether is happening. I also want to parse some of this arriving menu and use voltage values and current for data logging.
12-20-2012 02:42 PM
OK- lets start back at the beginning. I have a few questions...
WHy does incoming txt get placed at top of txt box and then scroll up? why would it make more sense to input at the bottom and scroll toward the top. I have created this huge txt box that appears to be impossible to use.
I have attached example of txt boxes I have tried, and pic of VI I have edited. Bad marks for uglyness....
12-20-2012 02:53 PM
You win! Boo did it, I just needed to change control to indicator and add non-zero to scroll value and make while function false (endless loop), works fine, EXACTLY as i would expect. Not sure how the scroll atributte works and why it does not seem to need to be wired to anything....