Top | Previous | Next |
Addressing |
The S7 protocol does not support browsing so all tags from the device must be configured as SQLTags in the Ignition designer. This can be done either manually, as needed, or by importing in bulk using the SQLTags CSV import functionality.
When creating a tag, the "OPC Item Path" field will be of the format: "[device_name]address", without the quotes, where device_name is the name given to the device during configuration and address is an S7 address, the format of which is described in the following text.
Tag addresses are made up of three different components: Area, DataType, and Offset.
To form an address you combine the desired Area and DataType with an Offset into that area. Examples: IB0 Byte at Offset 0 in the Inputs area. IW0 Word at Offset 0 in the Inputs area. DB500,DI8 DInt at Offset 8 in DataBlock 500. ISTRING24.50 A String of length 50 starting at offset 24 in the Inputs area. IX20.3 Bit 3 of the Byte at Offset 20 in the Inputs area. T0 Timer at offset 0 (No DataType is specified for Timers). C0 Counter at offset 0 (No DataType is specified for Counters).
It is important to note that offsets are absolute. IW0 and IW1 share a byte. To get 2 consecutive, non-overlapping words you would need to address IW0 and IW2.
Bits Bits are addressed by using the Bit DataType (X) and appending .bit to the end, where bit is in the range [0-7]. When addressing a Bit at a given offset, that offset is always treated as a Byte.
Strings Strings are assumed to be in the S7 string format and have a max length of 210.
Timers Timers are scaled up to a DWord and converted from S5 time format so they can represent the time in milliseconds without requiring any multipliers. When you write to a timer it is automatically converted from milliseconds into S5 time format for you. A DataType is not specified when accessing Timers.
Counters Counters in the PLC are stored in BCD. The driver automatically converts to/from BCD for you and exposes any counter tags as UInt16 values. A DataType is not specified when accessing Counters. |