11-28-2007 11:56 AM - edited 11-28-2007 11:57 AM
I have doubts about my LabVIEW code. I have to acquire data from several equipments using Serial Communication (RS232). This is a simple example of my code:

1st Question: Is there a way to generate Error dialog boxes from all equipments without have to connect the General Error Handler.vi to every single connection? (red box in the picture)
2nd Question: How could I simplify the code inside the blue box? I'd like to use Or logical comparators from several inputs.
3rd Question: If I receive a error from Serial connections (True from any Or port), I have like to break the execution of the remain code (at the orange box). There's a way to break the execution of a LabVIEW program in the middle of the code?
Thanks in advance!
Klein
11-28-2007 12:15 PM
11-28-2007 12:18 PM
Klein,
1. Use Merge Errors.vi to combine to one error and feed to one Simple Error Handler.vi
2. On Boolean palette, use Compound Arithmetic.vi and select "OR" as mode (left click to change).
3. Not sure I completely understand your question here. You could feed the output of blue box into a case statement and execute code for error or no error condition.
-cb
11-28-2007 01:25 PM - edited 11-28-2007 01:31 PM
Thanks johnsold and 10Degree for your replies.
Question 1: I had already tried this: Use Merge Errors.vi to combine to one error and feed to one Simple Error Handler.vi. I'm not sure if I'm using correctly the Merge Errors. This is because if I receive 4 errors from the Serial connections, when I use Merge Errors, the Simple Error Handler only displays one dialog box for only one error... I'd like to visualize all the four source errors. See the picture, I used the build array.vi to merge errors and input this into the Merge errors.vi and I used 2 Merge Errors.vi to compile the four inputs. The solutions displays me one only error dialog box.
Question2: Ok guys. I didn't know this function. It works great! Thanks.
Question3: "A state machine architecture for your entire program would make it more versatile" Johnsold. I'm not sure what it means. The LabVIEW is a typically dataflow programming language. This is ok. How could I program my code in a state machine architecture?
Advice4: "Rather than duplicating the serial code 4 times, create an array of the Sources and feed that to a for loop containing the code once" Ok, I got it. This simply the organization of the code.
"Put the error cluster in a shift register and the error handler outside and you do not need the merge errors or more than one error handler. The serial code and the error handler can easily be incorporated into a state machine as well." I'm really lost with this advice: "...error handler can easily be incorporated into a state machine as well" How can I do this, Johnsold?
"You could feed the output of blue box into a case statement and execute code for error or no error condition" This is a good solution, 10Degree.
I rebuild the code:

11-28-2007 01:57 PM
11-29-2007 07:18 AM
Johnsold,
It was really a great advice! I finally understood how to build a code using the State Machine concept with LabVIEW.
Thanks a lot!!!
Best regards,
Klein