System bus (can) for lenze plc devices, Lenzecandrv.lib function library – Lenze DDS System bus CAN for PLC User Manual

Page 155

Advertising
background image

System bus (CAN) for Lenze PLC devices

LenzeCanDrv.lib function library

10.8

L_CanPdoReceive − receiving a CAN object

10−13

L

PLC−Systembus EN 2.0

Receive status (nState)

Data type

Value

Meaning

Priority

Integer

−150

CAN bus is not in the Operational state.

1 (high)

−121

Incorrect driver number (wDrvNr)

2

−120

Driver not initialised

3

−12

The set message identifier (COB−ID) is beyond the permissible range (0 ... 2047).

4

−11

Pointer pIOAdress does not point to PLC−RAM.

5 (low)

* If there are several error causes, always the value associated with the error cause

of the highest priority is returned.

0

Data have been faultlessly received.

10

The specification for the telegram length byLen is higher than 8. The telegram length has been
limited to 8 bytes.

200

Data were received without resetting bNewMessage. Therefore valid data were possibly overwritten
in the receive memory.

Resetting the variable "bNewMessage"

If data have been received from the CAN bus, the output variable bNewMessage is set to TRUE and
only is reset to FALSE again by calling the action <Instance name>.ResetNewMessage:

(* FB instance *)

ReceiveFromID678:

L_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!

The use of an address which is stored in the memory area of the operating system is not permitted
for the L_CanPdoTransmit and L_CanPdoReceiveFBs!

·

See also note to the function L_CanPdoTransmit.

(

^ 10−8)

Advertising