System bus (can) for lenze plc devices, Lenzecandrv.lib function library, 7 l_canpdotransmit − transmitting a can object – Lenze DDS System bus CAN for PLC User Manual

Page 153

Advertising
background image

System bus (CAN) for Lenze PLC devices

LenzeCanDrv.lib function library

10.7

L_CanPdoTransmit − transmitting a CAN object

10−11

L

PLC−Systembus EN 2.0

Forced transmission

Some cases may require an entry of a transmit request in the transmit request memory without
considering a data change (event−controlled) or a cycle time (time−controlled).

For this purpose, the L_CanPdoTransmit FB supports the action SendData in the "Forced
transmission" transmit mode (byTransmitMode = 3).

Example

Declaration of the function block in ST:

SendWithID678:

L_CanPdoTransmit; (* send data with identifier 678 *)

Calling the function block in ST:

SendWithID678 (wDrvNr:=10,
byLen:=8,
dwCobID:=678,
pIOAdress:=

ADR(abySendData),

tRepeatTime:=T#5ms,
byTransmitMode:=3);

Action "Forced transmission" in ST:

SendWithID678.

SendData; (* force send procedure *)

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!

Problem:
The addresses of the system variables (inputs/outputs of system
blocks) are also placed in the memory area of the operating system, in
the following illustration the system variable AIN1_nIn_a:

Remedy:
Instead of the address of the system variable, use the address of a
temporary variable, which the value of the corresponding system
variable is copied into:

ADR

2

AIN1_nIn_a

L_CanPdoTransmit

wDrvNr
byLen
dwCobId
pIOAdress
tRepeatTime
byTransmitMode

nState

wNrOfCallsToSend

10

8

750

t#10ms

nAnalogInput

AIN1_nIn_a

nAnalogInput

ADR

2

L_CanPdoTransmit

wDrvNr
byLen
dwCobId
pIOAdress
tRepeatTime
byTransmitMode

nState

wNrOfCallsToSend

10

8

750

t#10ms

Advertising