7 mmi communication functions, Mmi communication functions, Plc programming – Lenze ETC Motion Control User Manual
Page 414
PLC programming
Library
MMI communication functions
8.8
8.8.7
l
414
EDSTCXN EN 2.0
8.8.7
MMI communication functions
8.8.7.1
GetApplicationMessage
FUNCTION_BLOCK GetApplicationMessage
(* fetches a message with up to 512 Byte user
data from the MMI *)
VAR_INPUT
data_pab
: POINTER TO ARRAY[0..511] OF BYTE;
Datatypes_s
: STRING(255);
END_VAR
VAR_OUTPUT
sb1_b
: BYTE;
sb2_b
: BYTE;
index_b
: BYTE;
handle_b
: BYTE;
len_w
: WORD;
ok
: BOOL;
END_VAR
data_pab
Pointer to received user data
Datatypes_s
Optional data descriptor, see DefDataTypes
sb1_b
Control block 1 of the message from HMI
sb2_b
Control block 2, optional
index_b
Block counter, optional
handle_b
Sender ID, reserved
len_w
Length of received user data in bytes
ok
TRUE, if a message has been received
With this function the PLC can fetch a message of type
SB0_SPSAUFTRAG_KUC (SB0=14) with up to 512 Byte user data from HMI.
Here the message buffer between NCR and MMI in the dual port RAM will be
used. The function can be used together with PutApplicationMessage to
establish a fast message communication between the PLC and HMI.
In data_pab a pointer to a buffer can be transferred where the received
message should be stored. For this it must be ensured that the buffer is large
enough to accept the received message. When starting or resetting the PLC
this pointer will automatically be initialised to the start of DB7 (%MW7.0).
If the format of the message to be received is known in advance, the data
descriptor datatypes_s can be used to automatically carry out the possibly
required byte swapping. Otherwise this must be carried out later with
MOVESWAPPED or the functions GET_WORD, GET_DWORD, etc. have to be
used to fetch the data from the message. If the defined descriptor string is
faulty the data will be transferred without byte swapping.
Declaration
Parameters
Description