You need to determine how many MHLs to add. Each MHL defines a task that executes in parallel with other tasks.
You have an application that acquires data and, in parallel, logs this data to disk.
This application consists of two tasks: data acquisition and data logging. Therefore, you need two Message Handling Loops.
Create a Message Handling Loop in LabVIEW Queued Message Handler Template
For each MHL, you need to determine what message diagrams to add.
A message diagram is a subdiagram of the Case structure in an MHL. Each subdiagram corresponds to a state the task can be in; therefore, to determine the message diagrams to add, separate each task into states.
You want to separate the data acquisition task into three states: Initialize, Acquire Data, and Exit. Therefore, create these message diagrams in the MHL that acquires data.
You want to separate the data logging task into three states: Initialize, Log, and Close. Therefore, create these message diagrams in the MHL that logs data.
Create a Message Diagram in LabVIEW Queued Message Handler Template
You must determine what data the message diagrams of an MHL need.
Each message diagram of the data acquisition MHL needs access to a hardware reference. The Initialize message diagram needs to open this reference, the Acquire Data diagram uses this reference to acquire data, and the Exit message diagram closes the reference.
Defining Data that a Message Handling Loop Needs section in Create a Message Diagram in LabVIEW Queued Message Handler Template
You need to determine when to execute each message diagram. A message diagram executes after its MHL receives the appropriate message. Therefore, you need to determine when to send each message to the MHL. You can send a message from a front panel control or from a message diagram.
You want to add a button that sends the Initialize message to the data acquisition MHL.
You then want the Initialize message diagram to send the Acquire Data message to the same MHL.
Send a Message to a Message Handling Loop in LabVIEW Queued Message Handler Template
You need to determine if you want the Exit message to stop each MHL. The Dequeue Message VI uses this message because it is able to shut down an MHL.
You want each MHL to shut down when it receives the Stop message instead of the Exit message.
Send a Message that Stops the MHL section in Send a Message to a Message Handling Loop in LabVIEW Queued Message Handler Template
When reading messages from the message queue, you need to determine if you want to ignore any specific errors.
When reading messages from the message queue, you want to ignore network timeout errors.
Handle Errors and Unrecognized Messages in LabVIEW Queued Message Handler Template