Supported platforms: CODESYS 3.5 SAFETY
This function block (FB) is used to define time triggered CAN message. The maximum number of messages is 10.
Minimum time interval for sending is 1 ms, but it is recommended to use intervals > 10 ms.
Message is initialized with InitCobId method and sending is started by setting i_Enable to TRUE.
Function block must be called at least every 100 ms, otherwise sending is stopped. New data is updated
by setting new values to i_Dlc and i_Data inputs and calling UpdateData method.
|
This method initializes time triggered CAN message.
Input variable name |
Data type |
Description |
i_CanChannel |
BYTE |
Used CAN channel |
i_CobId |
DWORD |
Used COB-ID |
i_TimeInterval |
TIME |
Time interval for sending |
Data type |
Description |
EPEC_SYSTEM.SYSTEM_ERROR_CODES |
FW error code. |
This method removes time triggered CAN message.
The method has no inputs.
Data type |
Description |
EPEC_SYSTEM.SYSTEM_ERROR_CODES |
FW error code. |
This method updates i_Dlc and i_Data values of time triggered CAN message.
The method has no inputs.
Data type |
Description |
EPEC_SYSTEM.SYSTEM_ERROR_CODES |
FW error code. |
Input variable name |
Data type |
Description |
i_Enable |
BOOL |
Enable operation |
i_Dlc |
BYTE |
Message length |
i_Data |
ARRAY [0..7] OF BYTE |
Message data |
Output variable name |
Data type |
Description |
o_UsedCanChannel |
BYTE |
Configured channel (= input for method InitCobId). |
o_InitializedCobId |
DWORD |
Configured COB-ID (= input for method InitCobId). |
o_UsedTimeInterval |
TIME |
Configured time interval (= input for method InitCobId). |
o_Error |
EPEC_SYSTEM.SYSTEM_ERROR_CODES |
FW error code. |
Definitions: |
|
canChannel:EPEC_CANL2.Channel; (*not required with MT code template*) timeTrgSending:EPEC_HWD.CanApiTimeTriggeredMsg; |
Init: |
|
(*If using MultiTool Creator, CAN channel init is already included in code template*) canChannel.InitCAN(0,250,0); (* Init channel 0 for 250 kbit/s*)
timeTrgSending.i_Enable := FALSE; timeTrgSending.i_Dlc := 8; timeTrgSending.InitCobId(0,16#100,T#10MS); (* Init message, 10ms interval *) |
|
|
|
|
Code: |
|
(*Update message data*) timeTrgSending.i_Data[0] : = 1; timeTrgSending.i_Data[1] : = 2; timeTrgSending.i_Data[2] : = 3; timeTrgSending.i_Data[3] : = 4; timeTrgSending.i_Data[4] : = 5; timeTrgSending.i_Data[5] : = 6; timeTrgSending.i_Data[6] : = 7; timeTrgSending.i_Data[7] : = 8; (*Update data for message handler*) timeTrgSending.UpdateData(); (*Call handler periodically*) timeTrgSending(i_Enable := TRUE);
|
SSeriesCanExt library
SSeriesSystemExt library
Source file topic100471.htm
Last updated 19-Dec-2024