User Tools

Site Tools


kb:production:s7-communication:write

13 Write Variable

Request

Params

Byte Value Description
Fixed Part
[0] 0x05 Write Variable = 0x05
[1] 0x01 Item Count (only 1 item)
[2] 0x12 Spec type (Variable Specification = 0x12)
[3] 0x0A Parameter length
[4] 0x…… Variable Addressing Mode (Syntax ID)
[5] 0x…… Variable Type
[6-7] 0x…… …… Count (number of elements of type Variable Type to read or write)

S7-Any Addressing (Syntax ID = 0x10)

Byte Value Description
[8-9] 0x…… …… Address of the data block in memory
[10] 0x…… Memory Area
[11-13] 0x…… …… …… offset of the addressed variable in the selected memory area (start address)

Drive-ES-Any Addressing (Syntax ID = 0xA2)

Byte Value Description
[8-9] 0x…… …… Drive Object
[10-11] 0x…… …… Parameter
[11-13] 0x…… …… Index

Data

Byte Value Description
Fixed Part
[0] 0x00 Error Code
[1] 0x…… Transport Data Type (depends on variable type)
[2-3] 0x…… …… Count (number of elements of type Transport Data Type to write)
Variable Part
[4-n] Data to write

Response

Params

Byte Value Description
Fixed Part
[0-1] 0x…… …… Error Code
[2] 0x05 Function Code (Write = 0x05)
[3] 0x…… Item Count

Data

Byte Value Description
Fixed Part
[0] 0x…… Response Item Return Code (one byte per item, 0xFF = success)
kb/production/s7-communication/write.txt · Last modified: 2023/11/27 11:18 by joerg.hampel