Activate particular configuration parametersΒΆ
The parameters set up in the Automation Builder device tree are NOT automatically taken over in the PLC.
It is still required to use the 3S IEC POUs to activate the particular configuration parameters.
ABB provides the library AC500_Com (ComGetCaaSerialComConfig.
which contains a POU calledThe Function Block can be used to obtain the configuration data which is set up in Automation Builder to directly pass it to CAA SerialCom-POU Open. This avoids manual creation of a parameter list.
The following code snippet shows, how the COM port is identified by its node name and how the parameter list for the Function Block is read from the configuration data of the currently loaded IEC application:
FUNCTION_BLOCK GET_CAA_COM_CFG
VAR_INPUT
END_VAR
VAR_OUTPUT
END_VAR
VAR
ComGetCaaSerialComConfig:\ ComGetCaaSerialComConfig;
\ bExecGetCfg:\ \ \ BOOL := FALSE;
\ bDoneGetCfg:\ \ \ BOOL := FALSE;
\ bErrorGetCfg:\ \ \ BOOL := FALSE;
\ bBusyGetCfg:\ \ \ BOOL := FALSE;
\ ErrorIdGetCfg:\ \ AC500_Com.ERROR_ID := AC500_Com.ERROR_ID.NO_ERROR;
\ asParamList:\ \ \ ARRAY[0..31] OF
AC500_Com.Serial_Communication.COM.PARAMETER;
\ uiNumParams:\ \ \ UINT := 32;
\
uiStep:\ \ \ UINT := 0;
\ szNodeName:\ \ \ STRING(80) := 'COM1';
\ ComID:\ \ \ \ AC500_Com.COM_PORT_ID;
\ bSuccess:\ \ \ BOOL := FALSE;
\ bError:\ \ \ BOOL := FALSE;
END_VAR
VAR CONSTANT
\ STEP_INIT:\ \ \ UINT := 0;
\ STEP_GET_ID:\ \ \ UINT := 1;
\ STEP_FAILED_GET_ID:\ \ UINT := NOT STEP_GET_ID;
\ STEP_GET_CFG_CAA:\ \ UINT := (STEP_GET_ID + 1);
\ STEP_FAILED_GET_CFG_CAA:\ UINT := NOT STEP_GET_CFG_CAA;
\ STEP_DONE_SUCCESS:\ \ UINT := (STEP_GET_CFG_CAA + 1);
END_VAR
IF uiStep = STEP_GET_ID THEN
\ ComId := ComGetIdByName(szNodeName);
\ IF ComId = AC500_Com.COM_PORT.COM_ID_INVALID THEN
\ \ uiStep := STEP_FAILED_GET_ID;
\ ELSE
\ \ bExecGetCfg := TRUE;
\ \ uiStep := STEP_GET_CFG_CAA;
\ END_IF
END_IF
IF uiStep = STEP_GET_CFG_CAA THEN
\ ComGetCaaSerialComConfig(
\ \ Execute:= bExecGetCfg,
\ \ Done=> bDoneGetCfg,
\ \ Busy=> bBusyGetCfg,
\ \ Error=> bErrorGetCfg,
\ \ ComID:= ComID,
\ \ pCaaParamList:= ADR(asParamList[0]),
\ \ NumParams:= uiNumParams,
\ \ ErrorID=> ErrorIdGetCfg);
\ IF bDoneGetCfg THEN
\ \ uiStep := STEP_DONE_SUCCESS;
\ ELSIF bErrorGetCfg THEN
\ \ uiStep := STEP_FAILED_GET_CFG_CAA;
\ END_IF
END_IF
IF uiStep = STEP_DONE_SUCCESS THEN
\ bSuccess := TRUE;
END_IF
IF uiStep = STEP_FAILED_GET_ID THEN
\ bError := TRUE;
END_IF
IF uiStep = STEP_FAILED_GET_CFG_CAA THEN
\ bError := TRUE;
END_IF