01-05-2010 01:12 PM
Hi,
I'm trying to build a code for automating one of my processes. This involves sending a query to my equipment (serial communication), obtaining the query result and proceeding depending on the result. For eg, if my query result is "RNU" , I perform a check to see if the first letter is "R" and the third is "N". If it is"R" and "N", I proceed, if it is "R" and "U", I need to repeat my previous steps. I tried putting it in a case structure for True and Flase cases. True seems fine, if it is Flase, I need to repeat whatever I had done earlier until it becomes True. I am having a hard time putting it all in a case structure. If I dont use any loops or structures, the block diagram is going to look messy and bulky. The enire code is full of comparisons that give a boolean output. Does anyone have any suggestions?
Thanks,
Sukanya
01-05-2010 01:34 PM
Sukanya,
The last lines of your posting give the clues you need. You need a loop. You need a case structure. And you need a shift register. When you have these three components, it suggests that a State Machine architecture is a good starting place.
Look at the examples which come with LabVIEW and the many postings here about state machines.
But before you start wiring your LV code, please take some time to carefully plan and design your program. That time will be well spent when compared to the time it will take to debug an unplanned program.
Lynn
01-06-2010 12:01 AM
Hi,
The above explanation is very useful.
If you want then you can post your code for review and optimization.
Regards,
Shrek