Checking the MERLIC State (Hilscher)
While working in the process integration MERLIC can be used in machine vision systems that are integrated in a manufacturing machine. The machine controller, e.g., a programmable logic controller (PLC), must be able to control an integrated vision system, to monitor the execution, and to query the results. Therefore, MERLIC provides a process integration mode to enable the communication with a machine controller. The process integration mode can be started with the application "MERLIC RTE" that is provided with the MERLIC installation. mode of MERLIC (MERLIC RTE), you might want to check the current state of MERLIC to trigger the signals at the correct time, for example, to query the results of an iteration after MERLIC finished a single execution.
During a continuous execution, MERLIC will execute a series of single executions without entering the "Ready" state between the executions. MERLIC will enter the "Ready" state after the continuous execution is stopped without checking if the result of the last execution has arrived yet.
Available MERLIC States
If you are using a Hilscher card to communicate with a programmable logic controller (PLC), each of the internal MERLIC states can be visualized in your system. The graphic below shows an overview of all internal states of MERLIC and its transitions when using MERLIC RTE.
Transitions that are triggered by commands are labeled with the respective name of the command, for example, the transition from the state "Ready" to "SingleExecution" via the command "StartSingleJob". Transitions that are triggered automatically by MERLIC due to internal conditions are displayed in orange without any label, for example, the transition from the state "SingleExecution" to "Ready" is performed automatically after a single execution.
The numbers that are shown for each MERLIC state represent the corresponding ID of the state. They provide relevant information when checking the current state of MERLIC.
The internal state of MERLIC is transmitted to the PLC via the member CurrentState of the protocol FromMerlicProtocol. For more information, see Protocols for the Data Exchange.
The byte that transmits the information about the current state is encoded as follows:
|
Bit field position |
Numeric value |
MERLIC state |
Description |
|---|---|---|---|
|
0 |
1 |
Preoperational |
If this bit is set to 1, MERLIC is in the state "Preoperational". |
|
|
|
OperationalAutomaticMode |
If this bit is set to 1, MERLIC is in the state "OperationalAutomaticMode". This means that MERLIC is either in the state "Initialized", "Ready", "SingleExecution", or "StartContinuous": |
|
|
|
Initialized |
If the 1st and 4th bit are set, MERLIC is in the state "Initialized". |
|
|
|
Ready |
If the 1st and 5th bit are set, MERLIC is in the state "Ready". |
|
|
|
SingleExecution |
If the 1st and 6th bit are set, MERLIC is in the state "SingleExecution". |
|
|
|
ContinuousExecution |
If the 1st and 8th bit are set, MERLIC is in the state "ContinuousExecution". |
|
|
|
Halted |
If this bit is set to 1, MERLIC is in the state "Halted". |
|
|
|
Error |
If this bit is set to 1, MERLIC is in the state "Error". |
|
|
|
OperationalFrontendAccessMode |
If this bit is set to 1 is set to 1, MERLIC is in the manual mode. This means that MERLIC can be controlled only via the MERLIC Frontend. For more information about the manual mode, see Write Access in the Frontend. |
Querying the Current State
You can get the current state of MERLIC from the data exchange protocol FromMerlicProtocol. It contains the member CurrentState with the value of the respective MERLIC state.
|
Member |
Description |
Offset |
Size in Byte |
|---|---|---|---|
|
CurrentState |
Contains the number of the current state of MERLIC. |
9 |
2 |
Although the size of CurrentState is 2 bytes, only the first byte is currently used for the transmission of the current state.
The following example excerpt shows how the information on the MERLIC state might be returned in the protocol FromMerlicProtocol:
TYPE
FromMerlicProtocol :
STRUCT
Preamble : 17;
...
CurrentState : 34;
...
END_STRUCT
END_TYPE
The value of CurrentState is 34. This means that MERLIC is currently in the state "Ready".