09-17-2009 03:16 PM
With the VISA READ in a loop the String Constant that the read buffer goes to refreshes each iteration.
With C++ I could create a String Array in memory and append to it, delete stuff from it, sort, reorder, etc - and then I could dump it into a visible text object so that it could be read by the user.
Is there a means to do this in LV? I'd like each iteration to append the what's shown in the String vs. clearing it each time and starting fresh.
thanks
09-17-2009 03:19 PM
Jerry In Maine wrote:With the VISA READ in a loop the String Constant that the read buffer goes to refreshes each iteration.
With C++ I could create a String Array in memory and append to it, delete stuff from it, sort, reorder, etc - and then I could dump it into a visible text object so that it could be read by the user.
Is there a means to do this in LV? I'd like each iteration to append the what's shown in the String vs. clearing it each time and starting fresh.
thanks
Sure. Take a look at "shift registers" and I think you'll be good to go!
09-17-2009 05:04 PM
As I understand I can't get the accumulated value of the register until the loop quits. Trouble is the info I need to accumulate is in a loop that runs continously as long as the app runs.
Maybe I misunderstood the HELP file. I'll re-read and keep digging....
thanks!
09-17-2009 07:02 PM
I think my "problem" is in the proper operation of the string control itself. I stripped the related functions out of any loops and what I see makes sense now. Each time text is assigned the string control it first blanks. Subsequent additions will all start with a blank - I had the impression that the controls contents would be appended with additional strings and perhaps the object had a "clear" method to empty it.
Any tips on accumulating the contents of a VISA read buffer in a string object? This would allow the user to scroll down if necessary to see previous results.
thanks
09-17-2009 08:25 PM - edited 09-17-2009 08:26 PM
As Billko said, you need to use a shift register. For that matter, you need to use a loop also. The code as you have it only executes one time.
09-18-2009 06:02 AM - edited 09-18-2009 06:05 AM
>>For that matter, you need to use a loop also. The code as you have it only executes one time.
I realize that (I might be dumb but geeez gimme a little credit )..
As mentioned, I striped the code out of the loop to see if the problem remained - and that's what the .vi I attached above reflecteds. The point was that the string control didn't seem to append new strings below the existing - rather it cleared each time new text is added.
I tried the shift register - but in a different manner than you showed. I'll give that a shot.
Thanks for the patience and help
09-18-2009 06:29 AM
Your fix worked. I was concatenating the data incorrectly with the shift registers. New text is now appended to existing.
I've got to work on the scroll bars as they scroll tothe top each iteration rather than keeping the new text in view but I think I should be able to handle that.
Thanks again
09-18-2009 08:08 AM
Great.
I see now you wanted the new information to go on top. Just go ahead and reverse the order of the inputs on the concatenate so the new data goes to the top input, and the shift register data goes to the bottom input.
Another possibility is to use a property node to cause the scroll bar to move to the bottom. I believe it is Text.ScrollPosition.
I myself would prefer the first option because with the second, if someone wants to scroll back to older information, the box will keep jumping to the latest everytime that property node is executed. I've seen this kind of thing happen in other programs (non LabVIEW) and it is annoying to have to the box jump around and continually have to find your spot again when trying to look at another part of the text box.
09-18-2009 10:01 AM
Jerry In Maine wrote:Your fix worked. I was concatenating the data incorrectly with the shift registers. New text is now appended to existing.
I've got to work on the scroll bars as they scroll tothe top each iteration rather than keeping the new text in view but I think I should be able to handle that.
Thanks again
Yay!!!