06-08-2010 02:07 PM - edited 06-08-2010 02:10 PM
Hi,
I'm trying to create a simple text parser with LabView. So far, I only want the parser to recognize three commands:
*loop n - indicates the start of a loop of commands to execute n times
*endloop - end of section of commands to loop
*pausetime n - pause the reading/output of commands for n milliseconds
I use a "Scan String for Tokens" to break the text in a text control by line breaks.
I use a case structure to recognize those commands with a default case that passes any other text to a text indicator.
I figured the easiest approach to dealing with the loops would be to make the VI recursive.
When I don't have a *loop/*endloop pair in my text control, all the other text gets sent to the text indicator correctly, and the *pausetime appears to pause the reading correctly.
When I have a *loop/*endloop pair in in my text control, the loop index is parsed correctly, the VI is called recursively, the "offset past token" is RETURNED as the point beyond *endloop, but I don't see any of the commands that lie between the *loop/*endloop pair ouput to the text indicator.
Can someone suggest what I might be doing wrong?
Thanks,
Jason Mazzotta
06-08-2010 03:45 PM
Nativie recursion was added in LabVIEW 2009. You are using 8.5 so you definitely have a serious penalty here.
You code is so full of outrageous code constructs that is makes little sense to try to understand it all.
Examples:
06-08-2010 04:04 PM
I am a bit new to LabView programming and I'm trying to get the program to work at all. So, I haven't had a chance to consider the best options for some of what I've done but ...
... to create an infinite loop. I could use a while loop, but I wanted to use the same FOR loop for finite and infinite looping
06-08-2010 04:09 PM
JackOTrades wrote:That is simply check to see if *loop has a parameter. I could use a comparison operator, and probably will, but that's what I found first off and it works.