Supported platforms: CODESYS 2.3, CODESYS 3.5
CANopen302_SDOManager handles access to CSDO channels. The application needs to define an array of CANopenCSDO instances; one instance for every node-ID.
SDO manager needs to be initialized with its Init action. Init action has to be done for each used CAN bus.
|
Input variable name |
Data type |
Range |
Description |
i_CanBusNbr |
BYTE |
0,1,2.. |
Number of used CAN bus. |
i_NodeId |
BYTE |
1..127 |
Node Id for which CSDO is wanted to reserve. |
i_CsdoArrayStart |
POINTER TO CANopenCSDO |
|
Pointer to the start of the CSDO instance array which is defined in the PLCopen application. |
i_CsdoArraySize |
BYTE |
|
Size of the array pointer to which was given above with input variable i_CsdoArrayStart. |
Input variable name |
Data type |
Range |
Description |
i_itfChannel |
CANVXD_API.ICANVXD |
|
CAN interface. (From Code_Template_globals, for example, G_CAN1_Channel: EPEC_CANL2.Channel;) |
i_NodeId |
BYTE |
1..127 |
Node Id for which CSDO is wanted to reserve. |
i_pCsdoArrayStart |
POINTER TO CANopenCSDO |
|
Pointer to the start of the CSDO instance array which is defined in the PLCopen application. |
i_CsdoArraySize |
BYTE |
|
Size of the array pointer to which was given above with input variable i_pCsdoArrayStart. |
Output variable name |
Data type |
Description |
o_Error |
CANopen302_ErrorCodes |
Error code |
o_CSDOHandle |
POINTER TO CANopenCSDO |
Handle to CSDO instance that is reserved for use. The pointer is set to NULL, if there is not free CSDO instance. |
Output variable name |
Data type |
Description |
o_Error |
CANopen302_ErrorCodes |
Error code |
o_pCSDOHandle |
POINTER TO CANopenCSDO |
Handle to CSDO instance that is reserved for use. The pointer is set to NULL, if there is not free CSDO instance. |
Action name |
Used inputs/outputs |
Description |
Init |
i_CanBusNbr i_CsdoArrayStart i_CsdoArraySize o_Error |
Action initializes CANopenCSDO instance array that is defined in the application. Init action is required for all used CAN buses. |
Reserve |
i_CanBusNbr i_NodeId o_Error o_CSDOHandle |
Action reserves CSDO instance for defined node-ID. When CSDO instance is reserved successfully, a pointer of the instance is returned to o_CSDOHandle and o_Error is set to CANopen302ErrorSuccess. Otherwise o_CSDOHandle is set to NULL and o_Error is set to CanOpen302ErrorNoFreeCsdoInstance.
NOTE! Action Release is required if this action is used. |
Release |
i_CanBusNbr i_NodeId o_Error |
Releases the defined CSDO instance. |
Action name |
Used inputs/outputs |
Description |
Init |
i_itfChannel i_pCsdoArrayStart i_CsdoArraySize o_Error |
Action initializes CANopenCSDO instance array that is defined in the application. Init action is required for all used CAN buses. |
Reserve |
i_itfChannel i_NodeId o_Error o_pCSDOHandle |
Action reserves CSDO instance for defined node-ID. When CSDO instance is reserved successfully, a pointer of the instance is returned to o_pCSDOHandle and o_Error is set to CANopen302ErrorSuccess. Otherwise o_pCSDOHandle is set to NULL and o_Error is set to CanOpen302ErrorNoFreeCsdoInstance.
NOTE! Action Release is required if this action is used. |
Release |
i_itfChannel i_NodeId o_Error |
Releases the defined CSDO instance. |
CANopen302ErrorBusNbrOutOfLimits
CANopen302ErrorNodeIdOutOfLimits
CanOpen302ErrorAddressFault
CanOpen302ErrorNoFreeCsdoInstance
CanOpen302ErrorNoInitForBus
CANopen302ErrorSuccess
CANopen302ErrorFailure
Definitions: |
|
CAN1_MyCsdos:ARRAY [1..10] OF CANopenCSDO; |
Init: |
|
(*In the beginning of the PLCopen application use init action *)
CANopen302_SDOManager.Init( i_CanBusNbr:= 0,i_CsdoArrayStart:= ADR(Can1_myCsdos),i_CsdoArraySize:= 10); |
Code: |
|
(* Get handle by defining bus and node id *) CANopen302_SDOManager.Reserve( i_CanBusNbr:= 0 ,i_NodeId:= 2,o_CSDOHandle=>myCsdoHandle); (* Make needed action by using CSDO instance. *) ... ... (* Release handle *) CANopen302_SDOManager.Release( i_CanBusNbr:= 0 ,i_NodeId:= 2);
|
Definitions: |
|
CAN1_MyCsdos:ARRAY [1..10] OF CANopenCSDO; |
Init: |
|
(*In the beginning of the PLCopen application use init action *)
CANopen302_SDOManager.Init( i_itfChannel:= G_CAN1_CANopenDevice.itfCanChannel, i_CsdoArrayStart:= ADR(Can1_myCsdos), i_CsdoArraySize:= 10); |
Code: |
|
(* Get handle by defining bus and node id *) CANopen302_SDOManager.Reserve( i_itfChannel:= G_CAN1_CANopenDevice.itfCanChannel ,i_NodeId:= 2, o_CSDOHandle=>myCsdoHandle); (* Make needed action by using CSDO instance. *) ... ... (* Release handle *) CANopen302_SDOManager.Release( i_itfChannel:= G_CAN1_CANopenDevice.itfCanChannel, i_NodeId:= 2);
|
CANopen initialization and transfer code examples for CODESYS 2.3 or CODESYS 3.5.
Source file Topic000409.htm
Last updated 19-Dec-2024