FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Saturday
Hello,
We have X3 PLC with S20-EC-BK and Smart Function Kit for Pressing, with Ethercat communication. I want to implement an error detection on bus, and I'm trying to use CXA_S20 library for it. Issue is, when I unplug S20's connection to PLC, its state changes to error "0x0001B: Sync Manager Watchdog" and stays that way even if I plug the cable back, until we reset the system.
Do you have any ideas how to detect or reset that?
Also, my current program is like below, using the library's example. If there is any real life implementation you can share, it'd be appreciated.
Thank you very much.
PROGRAM PRG_IOBusControl
VAR_INPUT
bExecuteStart : BOOL;
END_VAR
VAR
fbIH_S20ComConfiguration : IH_S20ComConfiguration; // Function block instance
bEnableComConfig : BOOL := TRUE; // Function block processing enabled( TRUE – once, edge-controlled )
bInOperationComConfig : BOOL; // TRUE: Function Block is working on its actual task
bErrorComConfig : BOOL; // TRUE: Indicates an error
ErrorIDComConfig : ERROR_CODE; // Class of error
ErrorIdentComConfig : ERROR_STRUCT; // Detailed information about error
enBusType : IH_S20_BUSTYPE; // Bus type selection
stBusConfig : IH_S20_BUS_CONFIG; // Bus configuration parameters
pS20BusHandle : POINTER TO IH_S20_BUS_IDENTIFIER; // Bus handle of S20IO configuration
strBusMaster : STRING(100) := 'ethercatmaster'; // EtherCAT Busmaster name
fbIH_S20ModuleDiagnosticsType02 : IH_S20ModuleDiagnosticsType02; // Fb Instance
bExecute : BOOL; // TRUE: Function is enabled
bDone : BOOL; // TRUE: Function Block has completed its task
bActive : BOOL; // TRUE: Function Block is working on its actual task
bError : BOOL; // TRUE: Indicates an error
ErrorID : ERROR_CODE; // Class of error
ErrorIdent : ERROR_STRUCT; // Detailed information about error
uiSlot : UINT := 1; // Module slot address. Bus coupler : 0, 1st Module after coupler:1 ... 63rd Module after coupler: 63
bResetError : BOOL; // It deletes the diagnostics memory and acknowledge the diagnostic messages in the module
wErrorNumber : WORD; // Module diagnostic message number
byPriority : BYTE; // Priority of diagnostic message. Refer Table: Priority
byChannel_Module : BYTE; // Represents the channel number/entire device, where the diagnostic message available. Refer Table: Channel_Module
wErrorCode : WORD; // Error code. Refer Table: ErrorCode & ErrorString
strErrorString : STRING(51); // Error in Text format. Refer Table: ErrorCode & ErrorString
END_VAR
// Bustype
enBusType := IH_S20_BUSTYPE.ETHERCAT;
// Bus Configuration
stBusConfig.EtherCAT.AddressType := CXA_S20.CXA_EthercatMaster.IL_ECAT_ADDRESS_TYPE.ECAT_ETHERCAT_ADDRESS; // Address type
stBusConfig.EtherCAT.BusMaster := ADR(strBusMaster); // Bus master name
stBusConfig.EtherCAT.SlaveAddress := 1001; // Address of the slave (bus coupler)
// IH_S20ComConfiguration FB Call
fbIH_S20ComConfiguration(
Enable:= bEnableComConfig,
InOperation=> bInOperationComConfig,
Error=> bErrorComConfig,
ErrorID=> ErrorIDComConfig,
ErrorIdent=> ErrorIdentComConfig,
BusType:= enBusType,
BusConfig:= stBusConfig,
S20BusHandle=> pS20BusHandle);
uiSlot := 1; // Module position
IF TRUE THEN // temporary
bExecute := TRUE;
END_IF
// Enable FB by making TRUE at 'bExecute' var
// IH_S20ModuleDiagnosticsType02 FB Call
fbIH_S20ModuleDiagnosticsType02(
Execute:= bExecute,
Done=> bDone,
Active=> bActive,
Error=> bError,
ErrorID=> ErrorID,
ErrorIdent=> ErrorIdent,
S20BusHandle:= pS20BusHandle,
Slot:= uiSlot,
ResetError:= bResetError,
ErrorNumber=> wErrorNumber,
Priority=> byPriority,
Channel_Module=> byChannel_Module,
ErrorCode=> wErrorCode,
ErrorString=> strErrorString);
IF fbIH_S20ModuleDiagnosticsType02.Active THEN
bExecute := FALSE;
bExecuteStart := FALSE;
END_IF
IF fbIH_S20ModuleDiagnosticsType02.Error THEN
GVL_System.eSystemState := E_SystemState.Error;
GVL_System.bError := TRUE;
END_IF
// Diagnostic Data will be available at:
// wErrorNumber
// byPriority
// byChannel_Module
// wErrorCode
// strErrorString
Tuesday
Hello,
did you consider to seperate the ecat-members in different sync-units... that can continue the communication in operational for those components in the line which are still connected.
SyncUnit is configured in the IOConfig.
Healting/restarting the ECAT master will integration missing member again. Please have a look into
Did I get you right? Does it answer your question?
Bye