|
<< Click to Display Table of Contents >>
Reading a Value with Timestamp |
This feature reads a value together with a timestamp stored next to this value in a device, in a single request, applying the timestamp read from a device natively to a Tag, instead of returning that timestamp as a second value, This avoids the need for a script to combine a value and its respective timestamp, and it works over the ISOTCP or ISOTCP243 protocols only.
Inside a DB variable, the value and its timestamp must be declared together, with the timestamp immediately after the value, and no gap between them, since this Driver reads both as a single contiguous block of bytes, according to the next example.
Value : Real // e.g.: offset 100
Timestamp : DTL // offset 104, right after Value
The Timestamp field must be a Siemens DTL (Date_And_Time_Long) variable, a standard 12-byte structure (YEAR, MONTH, DAY, WEEKDAY, HOUR, MINUTE, SECOND, and NANOSECOND). No additional programming is required on a device to build this structure. A simple assignment to a DTL variable, such as an RD_LOC_T instruction, already produces the expected layout.
NOTES |
•A DB variable must have the Optimized block access option disabled in the TIA Portal project, otherwise this Driver cannot read this variable. •The WEEKDAY field of the DTL structure is not used by this feature. |
A Tag for this feature can be configured either by Numerical Parameters [N/B] or by syntax, as described next. In both cases, this Tag must point to the address of the value, not the timestamp. The DTL variable is read automatically right after that.
Use the N1 and N3 parameters as described on topic Configuration by Numerical Parameters [N/B]. The N4 parameter must point to the offset of the value and, in the N2 parameter, use the formula DataType × 100 + 92 (data area 92), with the same codes for data types described on that topic. For example, for a REAL value (data type 7), N2 is equal to 792.
Use the next syntax, in which values inside brackets are optional.
<[Device:]>DTL<DBNumber>.<Type><Address>
The Device, DBNumber, and Address values refer to the same items described on topic Configuration by Syntactical Parameters, and Type is the data type of a value, such as DBF for a REAL value, from the same table of that topic, according to the next example.
(Device 0, REAL value starting at address 100 of DB1,
with its DTL timestamp right after it)
Device: Empty - Item: 0:DTL1.DBF100