CANOpen and CoDeSys PBF Part 1 - Basic Functions
CANOpen and CoDeSys PBF Part 1 - Basic Functions
1st Part
CoDeSys pbF and CANopen
functionality
The basics
NSC-F-FR/W.Gomolka
12.02.2015
12.02.2015
12.02.2015
NSC-F-FR/W.Gomolka
NSC-F-FR/W.Gomolka
NSC-F-FR/W.Gomolka
12.02.2015
NSC-F-FR/W.Gomolka
12.02.2015
12.02.2015
And of course, the EDS files for each slave which form part
of the user's CANopen network
NOTE:
CoDeSys also offers 3S_CanOpenNetVar.lib and 3S_CanOpenDevice.lib libraries,
but sometimes unused on some PLCs.
NSC-F-FR/W.Gomolka
CANopen
COMPLIANCE
CoDeSys
COMPATIBILITY
EASE of use
NSC-F-FR/W.Gomolka
12.02.2015
MAX_MASTERINDEX
A constant which corresponds to the maximum
number of Masters supported by the PLC
configuration
MAX_NODEINDEX
A constant which corresponds to the number of slave
nodes contained in the PLC configuration
pCANopenMaster:
Instance of the Function Block CanOpenMaster (Master functionality).
pCanOpenNode:
Instance of the Function Block CanOpenNode (Slave management).
NSC-F-FR/W.Gomolka
12.02.2015
CanOpenMaster
12.02.2015
dwHeartbeatTime: DWORD;
Interval in msec, used to control the reception of
Heartbeat messages from the node.
In the configurator, it is advisable to set the value 1.5
times higher than the node Hearbeat time.
EmcyMsg: CAN_Message;
The last Emergency Message
sent by the node
nStatus: INT;
Current status of the node.
0 : not defined
1 : The node is reset by the CANopen Master
2 : Master waits ~ 300 ms before reading object 0x1000 (Device Type). The status then changes to 3.
3 : Master starts (request 0x1000) the slave configuration via SDO messages
4 : Configuration completed and the node awaits the command Start Node; once this command is received, the status changes to 5.
5 : Normal operating status. The node receives and sends the PDO telegrams. Ditto for Master status!!
97: The Optional node has not been detected at startup
98: The node has responded to the Device Type request (object 0x1000) with a different value (EDS file)
99: LifeTime exceeded . Node monitoring error (Nodeguarding error)
NSC-F-FR/W.Gomolka
12.02.2015
10
Function Block
The data and node monitoring (Node Guarding, Heartbeat) are carried out by means of
the CanOpenNode Function Block
NSC-F-FR/W.Gomolka
12.02.2015
11
1) Resetting node
2) Checking node
(type and profile)
2. The type and profile (Object 0x1000) of each Slave are checked
a) If the Slave responds and is OK, it is configured (see p.3)
b) If the Slave responds but is not OK, it will still be configured, but
declared as INCORRECT (wrong type)
c) If the Slave does not respond, it is declared as NON-EXISTENT
4) Configuration of node
monitoring
(Nodeguarding, heartbeat)
5) Node startup
6) Initialisation of all
configured PDOs
3. Each correct Slave is configured (SDO telegrams sent with the configuration
parameters declared in the configurator)
4.If node monitoring has been enabled for Master, the monitoring parameters
(Nodeguarding, Heartbeat) are sent and node monitoring is enabled
5.Master executes node startup (NMT Start remote Node)
6.At the end, all of the declared PDOs are enabled and Master sends the PDOs
(Slave R_PDO) to the relevant slaves
(Transfer of PDOs)
NSC-F-FR/W.Gomolka
12.02.2015
12
pCanOpenMaster[0]();
pCanOpenNode[x]();
pCanOpenPDO_Rx[0]();
MgrClearRxBuffer(params)
NSC-F-FR/W.Gomolka
12.02.2015
13
12.02.2015
14
12.02.2015
15
NSC-F-FR/W.Gomolka
NSC-F-FR/W.Gomolka
12.02.2015
16
Com.Cycle Period
Sync.Window
length
NSC-F-FR/W.Gomolka
12.02.2015
17
12.02.2015
18
NSC-F-FR/W.Gomolka
NSC-F-FR/W.Gomolka
12.02.2015
19
12.02.2015
20
12.02.2015
21
NSC-F-FR/W.Gomolka
NSC-F-FR/W.Gomolka
NSC-F-FR/W.Gomolka
12.02.2015
22
Configuration of a CANopen Slave under CoDeSys : EDS file for the Slave
By default, under CoDeSys pbF, the available
slaves are located in the CANopen equipment
catalogue
If the slave is not contained in this catalogue,
the EDS file must be imported.
==========================================================
1. Click on CanOpenMaster(PLC
Configuration)
12.02.2015
23
12.02.2015
24
NSC-F-FR/W.Gomolka
For the selected Slave, theCANopen configurator reserves a certain number of Inputs and Outputs
(%I,%Q..) for available objects and mappable into PDO messages .
Their number and allocation (CAN Inputs/Outputs) depends on the default configuration defined
in the EDS file
NSC-F-FR/W.Gomolka
12.02.2015
25
12.02.2015
26
12.02.2015
27
NSC-F-FR/W.Gomolka
Note:
if DCF is used instead of EDS, only the CAN Input/Output
addresses can be modified.
NSC-F-FR/W.Gomolka
NSC-F-FR/W.Gomolka
12.02.2015
28
12.02.2015
29
12.02.2015
30
NSC-F-FR/W.Gomolka
carried out.
NSC-F-FR/W.Gomolka
10
NSC-F-FR/W.Gomolka
12.02.2015
31
12.02.2015
32
12.02.2015
33
NSC-F-FR/W.Gomolka
NSC-F-FR/W.Gomolka
11
NSC-F-FR/W.Gomolka
12.02.2015
34
PDO (Process Data Objects) messages are used for real time data transfers,
The operation of allocating Objects in the PDO message is performed via PDO Mapping
NSC-F-FR/W.Gomolka
12.02.2015
35
The Receive PDO mapping and Send PDO mapping tabs are used to modify the PDO messages
defined (by default) in the EDS file of the configured Slave.
The left-hand column contains all the mappable Objects that can be added ( >> button) to the
PDO messages (right-hand column).
The Insert PDO button is used to create an additional PDO message (right-hand column)
The Properties button is used to edit the PDO properties, (in accordance with CANopen standard).
NSC-F-FR/W.Gomolka
12.02.2015
36
12
NSC-F-FR/W.Gomolka
12.02.2015
37
The Properties button is used to edit the PDO properties, defined in CANopen.
NSC-F-FR/W.Gomolka
12.02.2015
38
12.02.2015
39
13
NSC-F-FR/W.Gomolka
12.02.2015
40
Often, for activation of the configured PDOs, it is also necessary to complete some SDO
parameters (objects) available in the Slaves Object Dictionary , e.g.,:
Otherwise, despite being present, the object configured in PDOs may not be sent
NSC-F-FR/W.Gomolka
12.02.2015
41
This object authorises the transmission of analogue inputs (in accordance with DS401)
Value to be entered in object 0x6423:
0 Disable (transmission not authorised)
1 Enable (transmission authorised)
NSC-F-FR/W.Gomolka
12.02.2015
42
14
This object defines how the analogue input must be checked to start the transmission
Values to be entered in the object 0x6421:
Bit 0 Upper limit exceeded
Bit 1 Lower limit exceeded
Bit 2 Change of value greater than Delta
Bits 3-7: Reserved
NSC-F-FR/W.Gomolka
12.02.2015
43
To start the transmission of an analogue input, the values corresponding to the properties
selected for object 0x6421must be entered
These values are contained in the following objects:
Object 0x6424 Upper limit value
Object 0x6425 Lower limit value
Object 0x6426 Delta Value
NSC-F-FR/W.Gomolka
12.02.2015
44
12.02.2015
45
End of 1stPart
NSC-F-FR/W.Gomolka
15