6 enabling and disabling macros, 7 initializing the macro response buffer, Operation and application – Siemens SIMATIC TIWAY 1 User Manual
Page 52
OPERATION AND APPLICATION
UNILINK HOST ADAPTER
2–42
USER MANUAL
2.10.6
Enabling and Disabling Macros
The ENABLE/DISABLE MACRO EXECUTION command explicitly enables
and/or disables defined macros for execution. When this command is processed
the exception flag will be cleared and the MRSW reset to 0000 hex if the macro is
being enabled, or the MRSW set to the disabled Termination Code 8001 hex if
the macro is being disabled. Macros will only be enabled when their associated
secondary device is online, otherwise, the ERROR RESPONSE will be returned
for that macro.
The adapter will return the ENABLE/DISABLE MACRO EXECUTION
command code, the Source Identification number, and a list containing a pair of
bytes for each requested buffer number. The first byte in the pair is the
requested buffer number and the second byte is the response code which
indicates whether the requested action was successful.
2.10.7
Initializing the Macro Response Buffer
There are two ways to insure that only a valid exception will set the exception
flag. The first way was shown in the DEFINE MACRO command. By setting Bit
3 in the macro options byte, the first macro response will be received, but not
compared to the contents in the macro response buffer. Thereafter, the new
responses will be compared to that first response.
The second way is to store a predefined value in the macro response buffer by
using the INITIALIZE MACRO RESPONSE BUFFER command. A useful
application is to define a macro that retrieves the status information from a
secondary device and sets the exception whenever the response is not “OK”. The
operating manual for the secondary device gives the exact Primitive response
that should be returned for a status “OK”. Preload this value into the macro
response buffer. Then, the exception flag will be set when the response is
anything other than the “OK” status that was expected.
The INITIALIZE MACRO RESPONSE BUFFER command byte string includes
the Source Identification number, the buffer number, the Primitive response
being preloaded, and an automatic enable byte. The macro must be disabled
before sending this command. The automatic enable byte can then be used to
enable the macro for execution after the response buffer is loaded without
having to issue a separate ENABLE/DISABLE MACRO EXECUTION
command.