Lenzefpidrv.lib function library, Functions – Lenze Global Drive PLC Developer Studio User Manual

Page 20

Advertising
background image

LenzeFpiDrv.lib function library

Functions

3.3

Send data (L_Rs232SendData)

3−5

L

LenzeFpiDrv.lib EN 1.1

Example 1

Calling up the function in ST for a single send order:

g_nSendStatus: =

L_Rs232SendData(30,

ADR(g_abySendData),

g_wNumberOfBytesToSend);

Example 2

Calling up the function in ST with monitoring of the last send order:

(* read state of sendprocess and send new data *)
(* if last sendprocess is finished *)

IF L_Rs232GetSendState (30) = 0 THEN

g_nSendStatus: =

L_Rs232SendData(30,

ADR(g_abySendData),

g_wLength);
END_IF

Note!

Addresses within the memory range of the operating system are not permitted with the functions
L_Rs232SendData and L_Rs232ReceiveData !

Problem:
Also the system variable addresses (inputs/outputs) are in the memory
range of the operating system, in the following figure it is the system
variable AIN1_nIn_a:

Remedy:
Instead of using a system variable address, use an intermediate
variable address to copy the corresponding system variable value to.

L_Rs232SendData

wDrvNr
pabySendDataMemory
wNumberOfBytes

ADR

30

2

AIN1_nIn_a

L_Rs232SendData

wDrvNr
pabySendDataMemory
wNumberOfBytes

ADR

30

2

nAnalogInput

AIN1_nIn_a

nAnalogInput

Advertising