System bus (CAN) with Ser vo PLC & Drive PLC
LenzeCanDrv.lib - Function blocks
9.2 Receive CAN object (L_CanPdoReceive)
9-6
L
PLC-Systembus EN 1.1
Receive state (nState)
Data typ e Value Meaning Priority
Integer -150 CAN bus is not in operating state operational. 1 (high)
-121 Wrong driver number (wDrvNr) 2
-120 Driver has not been initialised 3
-12 The set message identifier (COB-ID) is beyond the permissible area (0 ... 2047). 4
-11 pIOAdress pointer is not positioned over PLC RAM. 5(low)
* If errors are due to more than one e rror cause, the error cause with the highest priority sends back
the appropriate return value.
0 Data was received properly.
10 The value of the telegram length byLen is higher than 8. The telegram length was limited to 8 bytes.
200 Data was received without resetting bNewMessage. Valid data might have been overwritten in the
receive memor y.
Resetting the “bNewMessage” variable
If data was received from the CAN bus the
bNewMessage
output variable is set to TRUE and only
after calling the command <instance name>. ResetNewMessage reset to FALSE :
(* FB Instance *)
ReceiveFromID678: jL_CanPdoReceive; (* receive data *)
(* from identifier 678 *)
...
(* reset NewMessage information at FB ReceiveFromID678 *)
ReceiveFromID678. ResetNewMessage; (* reset NewMessage *)
Example
Calling the function block in ST:
ReceiveFromID678(wDrvNr:=10,
byLen:=8,
dwCobID:=678,
pIOAdress:= ADR(abyReceiveData);
Note!
With the L_CanPdoTransmit and L_CanPdoReceive FBs you must not use an address which is
within the memory area of the operating system!
• SeealsonotefortheL_CanPdoTransmit function. (^ 9-1)