beautypg.com

3 define the macro, Operation and application – Siemens SIMATIC TIWAY 1 User Manual

Page 48

background image

OPERATION AND APPLICATION

UNILINK HOST ADAPTER

2–38

USER MANUAL

2.10.4.3

Define The Macro

Use the DEFINE MACRO command, code 14, to define the macro and the macro
options. Figure 2–18 shows the DEFINE MACRO command frame. Macros can
connect a secondary, disconnect a secondary, or send a Primitive to a secondary.
These three functions are the macro types as shown in Table 2–2. The “connect”
and “disconnect” secondary macro types do not require any buffer storage to
hold the command, only 22 bytes for the header.

14

Source

Buffer

Secondary

Macro

Options Minimum Primitive

Id

#

Address

Type

Byte

Reissue

Delay

Data

Figure 2–18 Macro Command Frame

Table 2–2 Macro Types

Type

Code

01

02

03

Function Performed

Send Primitive to secondary

Connect the secondary

Disconnect the secondary

The UNILINK Host Adapter will return the Command Code, the Source
Identification number, and the buffer number to indicate that the command
was accepted. However, this does not mean that the secondary was actually
connected because macros are scheduled for later execution. When the
“connect” secondary macro is executed, the MRSW will be set to indicate if the
connect was successful or if not, why it failed. The “disconnect” secondary macro
type works just like the “connect” secondary type except that the secondary is
disconnected rather than connected. Both the “connect” and “disconnect”
secondary macro types are automatically enabled for execution when the
command is accepted from the host computer.