Previous | Contents | Index |
You can also read messages from or send messages to the programmable controller using the BASEstar Classic device connection management read data and write data functions.
The read data and write data message functions allow you to do an acknowledged write, an unacknowledged write or a read operation.
To read or write a message, one has to define the unsolicited TSAP by specifying the name of the unsolicited TSAP in the /NETADDR definition of the Siemens device.
The address data does not match a specific address in device storage. It specifies what kind of operation (read/write acknowledged/unacknowledged) has to be performed.
These operations are only allowed on an unsolicited device. |
Acknowledged Write Address Syntax
To perform an acknowledged write, the data address qualifier must have the following format:
/ADDRESS=ACK:xxxx
xxxx is any positive integer value that fits in a longword. This value is called a "message ID".
To write an acknowledged message to the device type the following:
DCM> WRITE DATA SIE_ONE/ADDRESS=ACK:587/FORMAT=STRING |
The DAS for Siemens H1 Protocol sends a buffer to the programmable controller to write the data.
This buffer consists of a message header followed by the data to be written. The message header has the following format:
The data part of this buffer has been converted to a format understandable by the programmable controller as specified in the format of the request.
The programmable controller must be programmed to understand the message header and to acknowledge the data written by sending back the message header.
The message ID can be used by the programmable controller to find out what kind of data has been written.
When the programmable controller responds, the DAS for Siemens H1 Protocol checks if the message ID and the request ID match a pending write request. If a matching write request has been found, the DAS will consider it as acknowledged and will return the acknowledgment to the application.
See Appendix C for a complete description of data exchange over the unsolicited TSAP.
Unacknowledged Write Address Syntax
To perform an unacknowledged write, the data address qualifier must have the following format:
/ADDRESS=NAK:xxxx
Where xxxx is any positive integer value that fits in a longword. This value is called a "message ID".
To write an unacknowledged message to the device type the following:
DCM> WRITE DATA SIE_ONE/ADDRESS=NAK:15349/FORMAT=ARRAY[10]:WORD |
The DAS for Siemens H1 Protocol will send a buffer to the programmable controller to write the data.
This buffer consists of a message header followed by the data to be written to the programmable controller. The message header has the following format:
The data part of this buffer has been converted to a format understandable by the programmable controller as specified in the format of the request.
In this case, when the second longword of the message header has been set to 0, the programmable controller must understand that it has no acknowledgement to return to the DAS for Siemens H1 Protocol.
Do not attempt to read using an unacknowledge write address. Doing so will result in an error being returned to the user. |
See Appendix C for a complete description of data exchange over the unsolicited TSAP.
Acknowledged Read Address Syntax
A message read operation is always acknowledged. To perform a read operation, the data address qualifier must have the following format:
/ADDRESS=ACK:xxxx
xxxx is any positive integer value that fits in a longword. This value is called "message ID".
To read a message from the device type the following:
DCM> READ DATA SIE_ONE/ADDRESS=ACK:1/FORMAT=STRING |
The DAS for Siemens H1 Protocol will send a request to the programmable controller to receive the data.
This request only consists of a message header having the following format:
The programmable controller must be programmed to understand the message header. In this case, when the message received by the programmable controller is only 2 longwords long, it has to answer by returning to the DAS the message header, followed by the requested data.
The message ID may be used by the programmable controller to find out what kind of data has been requested.
When the programmable controller responds, the DAS for Siemens H1 Protocol will check if the message ID and the request ID match a pending read request; it will extract the data from the response, convert it from programmable controller format to host understandable format as specified by the format of the request and return the converted data to the requesting application.
See Appendix C for a complete description of data exchange over the
unsolicited TSAP.
3.2.5 Send and Receive Message
To send or receive a message, one has to define the unsolicited TSAP by specifying the name of the unsolicited TSAP in the /NETADDR definition of the Siemens device.
These operations are only allowed on a device that is NOT defined as unsolicited. |
To send data, the application program calls routine ILAN$DEVICE_SPECIFIC specifying function code 51 and a buffer containing the data packet to be sent.
The DAS for Siemens H1 Protocol then writes this buffer on the unsolicited channel.
To receive data, the application program calls routine ILAN$DEVICE_SPECIFIC specifying function code 50 and a buffer to receive the data packet.
The DAS for Siemens H1 Protocol then tries to read data from the unsolicited channel.
When the programmable controller sends its data packet, the read operation completes and the data is returned to the application program.
See Appendix B for program examples. These programs are also available at SYS$COMMON:[SYSHLP.EXAMPLES.DCM_H1].
ILAN$DEVICE_SPECIFIC function codes are defined in the include file SYS$LIBRARY:DCM_H1$DEF.H for "C" program users.
Previous | Next | Contents | Index |