Search This Blog

_____________________________________________________________

Join Our Site To Subscribe

Monday, September 5, 2011

Program tracepoints

Tracepoints are programmed with the Tracepoint output instruction (TPT). When the inputs on a rung containing a TPT instruction are true, the TPT instruction writes a trace entry to a trace display or log file. (To configure how traces are displayed or logged, see Configure trace displays.)
Programming the TPT instruction
The Tracepoint (TPT) instruction has two kinds of parameters:
This parameter:
Contains:
Requires:
Format
A string that sets the formatting for the trace reports (both on-screen and logged to disk).
Trace This:
The tag you want to trace.
An INT, BOOL, SINT, DINT, or REAL tag.
You cannot trace tag structures (for example, entire timers or counters). However, you can trace individual structure members.
You can trace a large number of tags with the TPT instruction, but the formatting string can contain only 82 characters. Because two characters are required in the formatting string for each tag you want to trace, the maximum number of tags you could trace with a single TPT instruction is 41. However, you will probably want to include spaces and other formatting to separate tag data in your traces, so the resulting number of tags that can be traced by one TPT instruction is significantly lower than 41.
Example:
The following rung triggers a trace of three analog values when any one of them exceeds a given value (30.01).

We want to display the tracepoint information in a particular format. That format is contained in the Format string (myformat). In this case, the format string contains the following text:
Analog inputs trace:Analog inputs = %f, %f, and %f
When the tracepoint triggers, the characters before the colon ("Analog inputs trace") appear in the title bar of the trace window. The other characters make up the traces. In this example, the "%f" characters represent the tags to be traced ("analogvalue1," "analogvalue2," and "analogvalue3"). Click here for more information about formatting strings.
The resulting traces appear as shown in the following illustration.



When this trace is logged to disk, the characters before the colon appear in the traces. This indicates which tracepoint caused which trace entry. The following is an example of a trace entry. "Analog inputs trace:" is the heading text from the tracepoint's format string.
Analog inputs trace:Analog inputs = 31.00201, 30.282000, and 30.110001
Related Posts Plugin for WordPress, Blogger...