Context: We had an AOI that would stop working correctly at seemingly random times. It was noticed that a string tag would mysteriously lose its contents, thus causing the AOI to produce incorrect results. The tag in question was internal to the AOI, and not referenced as a destructive tag.
Set-up: The AOI contained RTOS instructions, with the result going into a string tag of length 12, based on the expected data range of the floating point operand. That REAL operand was the result of many additions and subtractions over time, and when it was supposed to be zero, it would end up with something like -9.50677431e-007, which is to be expected.
Watch-out: When a floating point value like the one mentioned goes into an RTOS with a destination string whose size is less than 16 characters, the result is truncated (see technote reference below), and there is no program fault. However, that truncation appears to over-write part of the next tag in memory.
Technote Reference (TechConnect access level):
Behaviour of RTOS with different STRING data sizes - Type 04 Code 52
This technote references an attached test program which was not available in my browser. Also, the screen shots are so blurry it is difficult to see exactly what they are doing. It is not a particularly helpful technote.
Steps to reproduce this behavior are as follows.
Test system: CompactLogix 5370 (L33), Firmware 32.13, Studio 5000
Test Tag w/ Data before executing test rung (note: STRING12 is a 12-character string type, and .S4 is a standard 80-character string):
Test Rung before toggling testBits[101]:
Test Rung after toggling testBits[101]:
Test Tag w/ Data after test rung (note change in strTest.S3):
Expanded Test Tag w/ Data after test rung (note characters still there, only .LEN seems to be affected):
There was no program fault, presumably because the result was truncated to fit in the 12-character string per the referenced Technote. There is no discussion of RTOS truncation in the online help.
The easy solution is to modify the RTOS target to be at least 16 characters in size. Or pre-round numbers near zero to be exactly zero, for the context and set-up described above.
Set-up: The AOI contained RTOS instructions, with the result going into a string tag of length 12, based on the expected data range of the floating point operand. That REAL operand was the result of many additions and subtractions over time, and when it was supposed to be zero, it would end up with something like -9.50677431e-007, which is to be expected.
Watch-out: When a floating point value like the one mentioned goes into an RTOS with a destination string whose size is less than 16 characters, the result is truncated (see technote reference below), and there is no program fault. However, that truncation appears to over-write part of the next tag in memory.
Technote Reference (TechConnect access level):
Behaviour of RTOS with different STRING data sizes - Type 04 Code 52
This technote references an attached test program which was not available in my browser. Also, the screen shots are so blurry it is difficult to see exactly what they are doing. It is not a particularly helpful technote.
Steps to reproduce this behavior are as follows.
Test system: CompactLogix 5370 (L33), Firmware 32.13, Studio 5000
Test Tag w/ Data before executing test rung (note: STRING12 is a 12-character string type, and .S4 is a standard 80-character string):
Test Rung before toggling testBits[101]:
Test Rung after toggling testBits[101]:
Test Tag w/ Data after test rung (note change in strTest.S3):
Expanded Test Tag w/ Data after test rung (note characters still there, only .LEN seems to be affected):
There was no program fault, presumably because the result was truncated to fit in the 12-character string per the referenced Technote. There is no discussion of RTOS truncation in the online help.
The easy solution is to modify the RTOS target to be at least 16 characters in size. Or pre-round numbers near zero to be exactly zero, for the context and set-up described above.
Last edited: