# BASEstartm Classic DAS
for Siemens H1tm Protocol
Installation and User's Guide

Previous | Contents | Index

## 3.2.4 Read and Write Data

Use the read and write data block functions to read data from and write data to a specific address in device storage. Use read and write data message functions to send and receive messages from the programmable controller. These message functions are available only if the device is "unsolicited".

### 3.2.4.1 Data Block Access

Use the read data and write data functions to read data from and write data to a specific address in device storage. Address display is specific to each device or device family.

To read data, one has to define the read TSAP. This is done with the /NETADDR definition of the Siemens device. If not already established, the DAS for Siemens H1 Protocol establishes the Transport connection to the READ TSAP of the programmable controller.

Next, the DAS for Siemens H1 Protocol sends a request to the programmable controller to receive the data. When the programmable controller responds, the DAS for Siemens H1 Protocol interprets the response, extracts the data from it, converts it from programmable controller format to host understandable format, and returns the converted data to the requesting application.

From the programmable controller's point of view, the CP-535 card receives the request for data from the user connected to the Ethernet. When the data is available, it is returned to its requestor. The CP-535 card and the CPU communicate via a dual-port RAM which must be properly synchronized between the two. Refer to Siemens documentation for more detailed information.

To write data, one has to define the write TSAP. This is done with the /NETADDR definition of the Siemens device. If not already established, the DAS for Siemens H1 Protocol establishes the transport connection to the write TSAP of the programmable controller.

Next, the DAS for Siemens H1 Protocol converts the data from the application to a format understandable by the programmable controller, and encapsulates it in a request to the programmable controller to write data.

Next, the DAS for Siemens H1 Protocol sends this request to the programmable controller to write the data. When the programmable controller responds, the DAS for Siemens H1 Protocol determines if the data was written successfully.

From the programmable controller's point of view, the CP-535 card receives the request to modify data from the user connected to the Ethernet. The result of the operation (successful or not) is then returned to its requestor. The CP-535 card and the CPU communicate via a dual-port RAM which must be properly synchronized between the two.

Addressing Syntax for Data Block Access

programmable controllers memory locations can be addressed according to the following syntax:

       <PC_block> : <block_number> : <block_offset>

or

       <PC_block> : <block_number>

Table 3-2 shows allowed values for PC_block , block_number and block_offset .

Table 3-2 Data Block Addressing
Block | Block Numbers | Block Offset | Format
--- | --- | --- | ---
DB | 1-255 | 0-2047 | STRING 1 BUFFER 2 WORD 3 LONG 4 FLOAT 5
DX | 1-255 | 0-2047 | STRING BUFFER WORD
DE | 1-255 | 0-2047 | STRING BUFFER WORD
FB | 0-255 |  | STRING BUFFER BYTE
IB | 0-127 |  | STRING BUFFER BYTE
OB | 0-127 |  | STRING BUFFER BYTE
PB | 0-127 |  | STRING BUFFER BYTE
CB | 0-255 |  | STRING BUFFER WORD
TB | 0-127 |  | STRING BUFFER BYTE
RF | 0-127 |  | STRING BUFFER WORD
AS | 0-65535 |  | STRING BUFFER WORD
EB | 0-255 |  | STRING BUFFER BYTE

1No format conversion occurs for string data.
2No format conversion occurs for buffer data.
3Word data is byte swapped.
4Longword data is transferred as two byte swapped words.
5Floating point data is converted to/from VAX float format.

Structured data is supported as long as all elements of the structure have the same format. Arrays of a supported format are also allowed.

CLI examples

To read or write to the device type the following:

    DCM> READ DATA S135/ADDR="DB:100:0"/FORMAT=ARRAY[10]:WORD

    DCM> WRITE DATA S150/ADDR="OB:10"/FORMAT:ARRAY[2]:BYTE

Addressing Syntax for TI Devices

TI programmable controllers memory locations can be addressed according to the following syntax:

       <PC_mem><element>

Table 3-3 shows allowed values for PC_mem and element .

Table 3-3 TI Addressing
Memory Type | Element | Format | Description
--- | --- | --- | ---
V | 1-10000 | WORD | Variable Memory
CR | 1-10000 | BYTE | Control Registers

CLI examples

To read or write to device TI type the following:

    DCM> READ DATA TI/ADDR="V1"/FORMAT=ARRAY[10]:WORD

    DCM> WRITE DATA TI/ADDR="CR5"/FORMAT:ARRAY[2]:BYTE

When performing the read or write to the programmable controller the DAS converts the address described above to an address of the form DB:<block_number>:<block_offset>.

The actual location read in the programmable controller is controlled by the parameters ILAN$H1_TI_V_BASE and ILAN$H1_TI_V_SIZE for variable memory and by the parameters ILAN$H1_TI_CR_BASE and ILAN$H1_TI_CR_SIZE for control registers. The DB block number and offset are calculated using the following formulas:

    block_number = BASE + ((element - 1) / SIZE)

    block_offset = element - ((block_number - BASE) * SIZE) - 1

See Section 2.3.4 for more information on the TI BASEstar parameters.

Previous | Next | Contents | Index