Master (FB) ¶ FUNCTION_BLOCK Master The FSoEBase Master function block implements the master side of the FSoE protocol and is responsible for establishing communication with an FSoE slave, parameterizing it and setting the FSoE watchdog time. With the call of the FB no execution is done, the flow control of the FSoE communication is executed by calling the functions of the FB. InOut: Scope Name Type Initial Comment Output S_eState FSOESTATE FSoE communication state S_xProcessData BOOL FALSE true, if the FSoE communication is established and valid FSoE frame with command PPROCESSDATA is received. S_byLocalError BYTE FSOEDIAG.LOCALRESET the local error of initialization or received FSoE frame event S_byDeviceError BYTE FSOEDIAG.LOCALRESET the received error from the FSoE device S_udiResponseTimeMS UDINT the FSoE response time in milliseconds for one cycle between FSoE master to slave and back Methods: Init Input Output ResetConnection Structure: Init (Method) Input (Method) Output (Method) ResetConnection (Method)
Master.Init (METH) ¶ METHOD Init : SAFEBOOL Function to initialize the FSoE communication. The communication parameters such as the ConnectionID, the FSoE address and the watchdog time, as well as the length of the send and receive FSoE PDUs are passed as parameters and checked for plausibility. The buffer with the optional application parameters for the FSoE slave is passed as parameter. If no application parameters are defined for the FSoE slave, then this buffer shall be passed as an empty buffer. Otherwise in the case of application parameters of the FSoE slave, the buffer with the bytes (set by the configuration) for the FSoE slave shall be passed. On the part of the FSoE master no further check shall be made regarding the consistency of the configuration. If a plausibilty check fails, the error code is stored in the instance variable S_byLocalError, the FSoE state changes to FSOESTATE.ERROR and the function returns with FALSE. If all plausibility checks are successful, the function returns with TRUE and all input values are stored in the corresponding instance variables. The minimum of the user data is calculated from the lengths of the FSoE PDUS and assigned to the instance variable _uiMinFrameDataSize. This function must be called once at the start of the application. InOut: Scope Name Type Initial Comment Return Init BOOL Input S_uiFSoEAddr UINT FSoE slave device address, error code FSOEDIAG_INVALID_COMMPARA S_uiConnId UINT Unique FSoE connection id, errorcode FSOEDIAG_INVALID_CONNID S_uiFWDT UINT FSoE watchdog time for given FSoE connection in millseconds S_uiSendFrameLen UINT Send FSoE frame telegram length S_uiRecvFrameLen UINT Receive FSoE frame telegram length S_pbyAppParam POINTER TO SAFEBYTE 0 Pointer to the optional application parameter buffer, default no application parameter buffer S_uiAppParamSize UINT 0 Size of the optional application parameter buffer
Master.Input (METH) ¶ METHOD Input : SAFEBOOL Function for temporal monitoring and to handle a received FSoE PDU. The return value of the function indicates if the FB state has changed. The input parameter S_pbyRecvFrame is the reference to a received FSoE PDU with the initialized length S_uiRecvFrameLen. If no new FSoE PDU has been received since the last call, only the check for a timeout regarding the FSoE communication is performed. S_pbyRecvFrame can either be NULL or point to the last FSoE PDU received. If an timeout error has occurred the transition FSOETRANSITION.TO_RESET is set according to the standard with the local error message FSOEDIAG.WDEXPIRED and the function returns with TRUE according to the FB state change. If no timeout error has occurred, the transferred FSoE PDU is checked FOR a change compared to the last call. In case of an unchanged FSoE PDU (no new FSoE PDU received) the state of the FB is unchanged and the function returns with FALSE. In the case of a changed FSoE PDU this is evaluated and a corresponding transition is set according to the protocol specification and the function returns with TRUE. If the function returns with TRUE, the output parameters S_byDeviceError and S_udiResponseTimeMS are updated. This function shall be called cyclically so that a temporal monitoring of the FSoE communication is ensured. InOut: Scope Name Type Comment Return Input BOOL Input S_pbyRecvFrame POINTER TO SAFEBYTE Pointer to the the received FSoE frame
Master.Output (METH) ¶ METHOD Output : SAFEBOOL Function to send a FSoE PDU The output data of the application shall be mapped into the user data area of the FSoE PDU of the transmit buffer and the input parameter S_xUseFailSafeData shall be used to mark the validity of the mapped user data. If no valid transition is set the function returns immediately with FALSE. The transition is executed according to the FSoE specification, such as generating an FSoE PDU to send, executing a state change, etc. With the return value TRUE a generated FSoE PDU is ready for sending in the send buffer, in the case of FALSE however not. In all cases an active transition (_eTransition = FSOETRANSITION.NOTPEDING) is reset after the call and the state of the FB (S_eState) is updated. This function shall be called after a successfull call of the function Input. InOut: Scope Name Type Comment Return Output BOOL Input S_pbySendFrame POINTER TO SAFEBYTE Memory description of the send FSoE frame S_xUseFailSafeData BOOL Flag to use failsafe data instead of process data
Master.ResetConnection (METH) ¶ METHOD ResetConnection : SAFEBOOL Function to reset a FSoE connection. The transition FSOETRANSITION.TO_RESET is set. The parameter S_byResetError overwrites the instance variable of the local error S_byLocalError. To reset the FSoE communication with transmission of the error, the Output FB function shall be called. InOut: Scope Name Type Comment Return ResetConnection BOOL Input S_byResetError BYTE Error code for the connection reset
Slave (FB) ¶ FUNCTION_BLOCK Slave The FSoEBase Slave FB implements the slave side of the FSoE protocol. The communication is established from the master side and the slave side receives the corresponding configuration and establishes the communication with the master with the specified parameters. The FSoE watchdog time, for example, is specified by the master side. With the call of the FB no execution is done, the flow control of the FSoE communication is executed by calling the functions of the FB. InOut: Scope Name Type Initial Comment Output S_eState FSOESTATE FSoE state S_uiFWDT UINT from Master received F-WatchdogTime S_uiConnId UINT from FSoE master received unique connection id S_xCheckParameterEvent BOOL event to check the stored application parameter. ATTN: Must be done before the method output is called! S_xProcessData BOOL FALSE true, if the FSoE communication is established and valid FSoE frame with command PPROCESSDATA is received. S_byLocalError BYTE FSOEDIAG.LOCALRESET local fault reason S_byMasterError BYTE FSOEDIAG.LOCALRESET the reported error from the FSoE master Methods: Init Input Output ResetConnection Structure: Init (Method) Input (Method) Output (Method) ResetConnection (Method)
Slave.Init (METH) ¶ METHOD Init : SAFEBOOL Function for initialization of the FSoE communication. The communication parameters, the own configured FSoE address, a buffer for the expected application parameters, as well as the length of the send and receive FSoE PDUs are passed as parameters and checked for plausibility. If a plausibilty check fails, the error code is stored in the instance variable S_byLocalError, the FSoE state changes to FSOESTATE.ERROR and the function returns with FALSE. If all plausibility checks are successful, the function returns with TRUE and all input values are stored in the corresponding instance variables. The minimum of the user data is calculated from the lengths of the FSoE PDUS and assigned to the instance variable _uiMinFrameDataSize. This function must be called once at the start of the application. InOut: Scope Name Type Initial Comment Return Init BOOL Input S_uiFSoEAddr UINT Own FSoE device slave address S_uiSendFrameLen UINT Send FSoE frame telegram length S_uiRecvFrameLen UINT Receive FSoE frame telegram length S_pbyAppParam POINTER TO SAFEBYTE 0 Pointer to the optional application parameter buffer, default no application parameter buffer S_uiAppParamSize UINT 0 Size of the optional application parameter buffer
Slave.Input (METH) ¶ METHOD Input : SAFEBOOL Function for temporal monitoring and to handle a received FSoE PDU. The return value of the function indicates if the FB state has changed. The input parameter S_pbyRecvFrame is the reference to a received FSoE PDU with the initialized length S_uiRecvFrameLen. If no new FSoE PDU has been received since the last call, only the check for a timeout regarding the FSoE communication is performed. S_pbyRecvFrame can either be NULL or point to the last FSoE PDU received. If an timeout error has occurred the transition FSOETRANSITION.TO_RESET is set according to the standard with the local error message FSOEDIAG.WDEXPIRED and the function returns with TRUE according to the FB state change. If no timeout error has occurred, the transferred FSoE PDU is checked FOR a change compared to the last call. In case of an unchanged FSoE PDU (no new FSoE PDU received) the state of the FB is unchanged and the function returns with FALSE. In the case of a changed FSoE PDU this is evaluated and a corresponding transition is set according to the protocol specification and the function returns with TRUE. If the function returns with TRUE, the output parameters S_byMasterError, S_uiFWDT and S_xCheckParameterEvent are updated. If the transmission of the communication and application parameters from the master to the slave is completed, i.e. the slave receives the first FSoE PDU with the FSoE command FSOECMD.PROCESSDATA or FSOECMD.FAILSAFEDATA and the check of the plausibility of the receipt of communication and application parameters is valid, then the received monitoring time of the communication at the output S_uiFWD, as well as the flag S_xCheckParameterEvent is set. With the set flag S_xCheckParameterEvent the user is requested to check the set monitoring time and also the application parameters for their validity. In case of an error, the function ResetConnection shall be called with the corresponding error code before the function Output is called, in order to reset the FSoE communication with a corresponding error message. This function shall be called cyclically so that a temporal monitoring of the FSoE communication is ensured. InOut: Scope Name Type Return Input BOOL Input S_pbyRecvFrame POINTER TO SAFEBYTE
Slave.Output (METH) ¶ METHOD Output : SAFEBOOL Function to send a FSoE PDU The output data of the application shall be mapped into the user data area of the FSoE PDU of the transmit buffer and the input parameter S_xUseFailSafeData shall be used to mark the validity of the mapped user data. If no valid transition is set the function returns immediately with FALSE. The transition is executed according to the FSoE specification, such as generating an FSoE PDU to send, executing a state change, etc. With the return value TRUE a generated FSoE PDU is ready for sending in the send buffer, in the case of FALSE however not. In all cases an active transition (_eTransition = FSOETRANSITION.NOTPEDING) is reset after the call and the state of the FB (S_eState) is updated. This function shall be called after a successfull call of the function Input. InOut: Scope Name Type Comment Return Output BOOL Input S_pbySendFrame POINTER TO SAFEBYTE Pointer to the send FSoE PDU with the already mapped data of the application S_xUseFailSafeData BOOL Flag that indicates the validity of the mapped output data
Slave.ResetConnection (METH) ¶ METHOD ResetConnection : SAFEBOOL Function to reset a FSoE connection. The transition FSOETRANSITION.TO_RESET is set. The parameter S_byResetError overwrites the instance variable of the local error S_byLocalError. To reset the FSoE communication with transmission of the error, the Output FB function shall be called. The function stops the temporal monitoring. InOut: Scope Name Type Comment Return ResetConnection BOOL Input S_byResetError BYTE Error code for the connection reset