2 the parts of a macro, Operation and application – Siemens SIMATIC TIWAY 1 User Manual
Page 42
OPERATION AND APPLICATION
UNILINK HOST ADAPTER
2–32
USER MANUAL
2.10.2
The Parts of a Macro
MACRO HEADER
MACRO COMMAND BUFFER
MACRO RESPONSE BUFFER
Figure 2–14 The Parts of a Macro
Each macro is stored in a variable length buffer. The macro buffer is referenced
by a unique buffer number assigned by the HIU function when the buffer is
allocated. This buffer number ranges from 1 to 254 (01 hex to FE hex) so that up
to 254 buffers can be allocated, depending on the size of each macro and the
amount of memory set aside for the macro buffers. Each macro buffer consists of
command and response buffers referenced by the same unique buffer number
and a macro header as shown in Figure 2–14. You specify the size of each macro
command buffer and its corresponding macro response buffer in the
ALLOCATE MACRO BUFFER command. Use the following formula to
calculate the number of bytes of memory required for each macro:
Macro Memory = 22 Bytes + Macro Command + Macro Response
(Header)
Buffer Length
Buffer Length
If this total is an odd number of bytes, add one to make the total count even.
The header is a storage area for the macro operating parameters, one of which is
the Macro Response Status Word (MRSW). The MRSW is normally a counter
that holds the number of times a repetitive macro has been executed. However,
if an error or exception occurs, a termination code indicating the cause of the
error will be stored there. Send the GATHER MACRO RESPONSE command to
get the MRSW value. The header also contains the Source Id and the secondary
address associated with the macro, and internally used pointers and flags.