Some improvements and fixes

- Added robot schift params for aligning etcher 1 position
- Added HMI Interface to robot fb
- Added machine LED's at main cabinet
- Aligner now works in auto mode
- Added HMI interface to etcher station
- Added cReleaseAlarms to HeatCoolPlates
- Added HMI interface to HVTester
- STarted tray feeder response parsing
- Fixed some packml base state machine bugs
This commit is contained in:
2026-02-15 10:04:59 +01:00
parent d6a4fc6e42
commit 0c40092d8f
26 changed files with 1259 additions and 190 deletions

View File

@@ -5,12 +5,13 @@
VAR_INPUT
sIpAddr : STRING(15);
udiPort : UDINT;
xConnect : BOOL := TRUE;
xReleaseAlarms : BOOL;
xConfirmAlarms : BOOL;
END_VAR
VAR_OUTPUT
stStatus : ST_TrayFeederStatus;
xConnected : BOOL;
xNewResponseReady : BOOL;
xBusy : BOOL;
xError : BOOL;
@@ -19,7 +20,6 @@ VAR
// Connection settings
_fbTcpConnection : FB_ClientServerConnection;
_hSocket : T_HSOCKET;
_xConnect : BOOL := TRUE;
_xConnected : BOOL;
// Socket send
@@ -29,20 +29,23 @@ VAR
// Socket receive
_fbSocketReceive : FB_SocketReceive;
_timReceiveTimeout : TIME := T#5S;
_timReceiveTimeout : TIME := T#1M;
_abyReceivedBuffer : ARRAY[0..100] OF BYTE;
_sReceivedResponse : STRING(255);
_udiResponseLength : UDINT;
_udiReceivedBytes : UDINT;
_timPollingTime : TIME := T#1S;
_timPollingTime : TIME := T#100MS;
_tonPollTimer : TON;
_xEnableReceiveTimeout : BOOL;
_timReceiveTimeoutTime : TIME := T#5S;
_timReceiveResponseTimeout : TIME := T#5S;
_tonReceiveTimeout : TON;
// Receive state machine
_iStateReceive : INT;
// Command parser
_fbParser : FB_TrayFeederParser;
// Command data
_uiCmdId : UINT := 1;
_sCmd : STRING(255);
@@ -58,7 +61,15 @@ VAR
_xReceivedResponseOk : BOOL;
_uiReceivedCommandId : UINT;
// Alarms
_fbWrongCmdIdAck : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.WrongCmdIdAck, xWithConfirmation := TRUE);
_fbResponseNotOk : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.ReceivedResponseNotOk, xWithConfirmation := TRUE);
_fbWrongResponseIndicator : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.WrongResponseIndicator, xWithConfirmation := TRUE);
_fbSocketReadError : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.SocketReadError, xWithConfirmation := TRUE);
_fbSocketWriteError : FB_AlarmMessage(stEventEntry := TC_EVENTS.TrayFeeder.SocketWriteError, xWithConfirmation := TRUE);
// Buffer before output
_sResponse : STRING(255);
_xBusy : BOOL;
_xError : BOOL;
END_VAR
@@ -75,7 +86,7 @@ _fbTcpConnection(
nMode:= ,
sRemoteHost:= sIpAddr,
nRemotePort:= udiPort,
bEnable:= _xConnect,
bEnable:= xConnect,
tReconnect:= T#2S,
bBusy=> ,
bError=> ,
@@ -87,7 +98,7 @@ _fbTcpConnection(
_xConnected := (_fbTcpConnection.eState = E_SocketConnectionState.eSOCKET_CONNECTED);
// Receive timeout after sending a command
_tonReceiveTimeout(IN := _xEnableReceiveTimeout, PT := _timReceiveTimeoutTime);
_tonReceiveTimeout(IN := _xEnableReceiveTimeout, PT := _timReceiveResponseTimeout);
// Receive state machine
CASE _iStateReceive OF
@@ -121,12 +132,12 @@ CASE _iStateReceive OF
ELSE
_iStateReceive := 15;
END_IF
END_IF
// If we have an error, check if we are connected
IF _fbSocketReceive.bError THEN
_fbSocketReceive(bExecute := FALSE);
_fbSocketReadError.xActive := TRUE;
_iStateReceive := 0;
END_IF
@@ -148,7 +159,8 @@ CASE _iStateReceive OF
// Check received data
20:
// Check if received command is complete
// Get command
MEMSET(destAddr := ADR(_sReceivedResponse), fillByte := 0, n := SIZEOF(_sReceivedResponse));
MEMCPY(destAddr := ADR(_sReceivedResponse), srcAddr := ADR(_abyReceivedBuffer), n := _udiReceivedBytes);
_udiResponseLength := _udiReceivedBytes;
_udiReceivedBytes := 0;
@@ -157,6 +169,14 @@ CASE _iStateReceive OF
// Go back to polling wait state
_iStateReceive := 15;
// Error
90:
_xError := TRUE;
IF xConfirmAlarms THEN
_fbSocketReadError.xActive := FALSE;
_iState := 0;
END_IF
ELSE
;
END_CASE
@@ -179,6 +199,7 @@ _xRunSMAgain := FALSE;
IF _xSendCmd THEN
_xSendCmd := FALSE;
_xCmdReceived := FALSE;
_xBusy := TRUE;
_iState := 20;
END_IF
@@ -211,6 +232,7 @@ _xRunSMAgain := FALSE;
IF _fbSocketSend.bError THEN
_fbSocketSend(bExecute := FALSE);
_fbSocketWriteError.xActive := TRUE;
_iState := 90;
END_IF
@@ -245,13 +267,15 @@ _xRunSMAgain := FALSE;
// Check for cmd id
IF (_sReceivedResponse[0] <> UINT_TO_BYTE(_uiCmdId+16#30)) THEN
// Wrong command id received
_iState := 900;
_fbWrongCmdIdAck.xActive := TRUE;
_iState := 90;
END_IF
// For for response indicator
IF _sReceivedResponse[1] <> F_ToASC('<') THEN
// Wrong response indicator
_iState := 901;
_fbResponseNotOk.xActive := TRUE;
_iState := 90;
END_IF
// Check for correct cmd
@@ -267,11 +291,18 @@ _xRunSMAgain := FALSE;
_xBusy := FALSE;
_iState := 10;
ELSE
_iState := 902;
_fbResponseNotOk.xActive := TRUE;
_iState := 90;
END_IF
// Got command from tray feeder which needs to be acknowledged
50:
IF _sReceivedResponse[1] <> F_ToASC('<') THEN
xNewResponseReady := TRUE;
MEMSET(ADR(_sResponse), 0, n := SIZEOF(_sResponse));
MEMCPY(destAddr := ADR(_sResponse), srcAddr := ADR(_sReceivedResponse)+1, n := _udiResponseLength-1);
END_IF
// Copy first 11 bytes
FOR _diCounter := 0 TO 10 DO
_sAck[_diCounter] := _sReceivedResponse[_diCounter];
@@ -285,15 +316,14 @@ _xRunSMAgain := FALSE;
// Get command id
_uiReceivedCommandId := _sReceivedResponse[0] - 16#30;
_xRunSMAgain := TRUE;
_iState := 60;
_iState := 70;
ELSE
_xRunSMAgain := TRUE;
_iState := 10;
END_IF
// Send ack response
60:
70:
// Ack is always 11 bytes long (11 characters)
_fbSocketSend(
sSrvNetId:= '',
@@ -310,7 +340,7 @@ _xRunSMAgain := FALSE;
_fbSocketSend(bExecute := FALSE);
_xEnableReceiveTimeout := TRUE;
_xBusy := FALSE;
_iState := 10;
_iState := 80;
END_IF
IF _fbSocketSend.bError THEN
@@ -318,6 +348,13 @@ _xRunSMAgain := FALSE;
_iState := 90;
END_IF
// Parse response
80:
_xRunSMAgain := TRUE;
_fbParser.M_ParseCmd(_sResponse);
stStatus := _fbParser.stStatus;
_iState := 10;
// Error
90:
_xError := TRUE;
@@ -326,6 +363,10 @@ _xRunSMAgain := FALSE;
IF xConfirmAlarms THEN
_xError := FALSE;
_uiRetries := 0;
_fbWrongCmdIdAck.xActive := FALSE;
_fbResponseNotOk.xActive := FALSE;
_fbWrongResponseIndicator.xActive := FALSE;
_fbSocketWriteError.xActive := FALSE;
_iState := 0;
END_IF
@@ -335,11 +376,43 @@ _xRunSMAgain := FALSE;
UNTIL (NOT _xRunSMAgain)
END_REPEAT
// Handle alarms
_fbWrongCmdIdAck(
xRelease:= xReleaseAlarms,
xAcknowledge:= xConfirmAlarms);
_fbResponseNotOk(
xRelease:= xReleaseAlarms,
xAcknowledge:= xConfirmAlarms);
_fbWrongResponseIndicator(
xRelease:= xReleaseAlarms,
xAcknowledge:= xConfirmAlarms);
_fbSocketReadError(
xRelease:= xReleaseAlarms,
xAcknowledge:= xConfirmAlarms);
_fbSocketWriteError(
xRelease:= xReleaseAlarms,
xAcknowledge:= xConfirmAlarms);
// Copy output buffers to outputs
stStatus := _fbParser.stStatus;
xConnected := _xConnected;
xBusy := _xBusy;
xError := _xError;]]></ST>
</Implementation>
<Method Name="M_GetResponse" Id="{7a67e859-37fc-4044-a956-f01ee59f215c}">
<Declaration><![CDATA[METHOD M_GetResponse : STRING(255)
VAR_INPUT
END_VAR
]]></Declaration>
<Implementation>
<ST><![CDATA[M_GetResponse := _sResponse;
xNewResponseReady := FALSE;]]></ST>
</Implementation>
</Method>
<Method Name="M_SendCmd" Id="{d00a8c1a-c183-4659-9c9e-be5b30566b7c}">
<Declaration><![CDATA[METHOD M_SendCmd : BOOL
VAR_INPUT
@@ -364,11 +437,12 @@ END_IF
// Create command with id
_sCmd := CONCAT(UINT_TO_STRING(_uiCmdId), '>');
_sCmd := CONCAT(_sCmd, sCmd);
_iCmdLength := LEN(sCmd);
_iCmdLength := LEN(_sCmd);
// start sendind command state machine
// start sending command state machine
_xSendCmd := TRUE;
_xBusy := TRUE;
xNewResponseReady := FALSE;
M_SendCmd := TRUE;]]></ST>
</Implementation>