LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I use serial port read and show text, but not have it scroll off screen?

Solved!
Go to solution

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  

0 Kudos
Message 1 of 10
(4,158 Views)

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 

----------------------------------------------------------------------------------------------------------------------------
"If anyone needs me, I'll be in the Angry Dome!"


0 Kudos
Message 2 of 10
(4,153 Views)

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.

 

0 Kudos
Message 3 of 10
(4,142 Views)
Solution
Accepted by topic author Steve010

A long shot.

Is this what u want?

 

0 Kudos
Message 4 of 10
(4,119 Views)

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. 

0 Kudos
Message 5 of 10
(4,105 Views)

@ AKA_TG;

 

this is an input, I need a display/output.

0 Kudos
Message 6 of 10
(4,103 Views)

@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?

0 Kudos
Message 7 of 10
(4,102 Views)

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. 

0 Kudos
Message 8 of 10
(4,100 Views)

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....

Download All
0 Kudos
Message 9 of 10
(4,095 Views)

@AKA_TG

 

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....

0 Kudos
Message 10 of 10
(4,085 Views)