Command Cross Reference List

Symbol: Command Cross Reference List 1:

Function: The command opens the Cross Reference List view.

Call: Menu PLC > Window

Cross Reference List view

The view shows a list of cross-references in the project for a symbol. The symbol can be a variable, a POU (program, function block, function) or a user-specific data type (DUT).

The cross reference list basically offers two types of search:

Command Cross Reference List 2:

Toolbar

Name
(input field)

Symbol name (variable name, function block name, DUT name)

Possible entries:

  • Selection of a declared symbol via the input assistant (button Command Cross Reference List 3: )
  • Manual input of the symbol name.
    Trigger the search via the button Command Cross Reference List 4: or the [Enter] key.
    You can use the placeholders "*" (any number of characters) or "?" (exactly any character) in combination with a substring of a variable identifier for the text search. Use "%" if you want to search for IEC addresses. Examples: "%MW8", "%M*"

Additional options from outside the view Cross Reference List:

  • Using the context menu command Find All References, if the name of a declared symbol is selected in an editor or the cursor is in the name.
  • Automatically, if the name of a declared symbol is selected in an editor or the cursor is in the name. An automatic search is also possible if the object is selected in the project tree.
    Requirements: The Cross Reference List view is open and the TwinCAT option Automatically list selection in cross reference view, category Smart Coding, is activated.

The following entries are valid:

  • Variable name, simple or qualified: e.g. "nVar", "MAIN.nVar"
  • Function block name: e.g. "MAIN", "FB_MyFB"
  • DUT name: e.g. "ST_MySTRUCT"
  • Strings in combination with placeholder "*" (any character) or "?" (exactly any character):
    Example:
    "nVar*" matches nVar1, nVarGlob2, nVar45 etc..
    "nVar?" matches nVar1, nVar2, nVarX etc., but not nVarGlob2, nVar45 etc.
  • "%<IEC address>": TwinCAT searches for variables assigned to this address and direct memory accesses.
    Example: "%QB0", "%Q0 := 2"

Upper/lower case and spaces at the beginning and end of the input string are ignored.

Command Cross Reference List 5:

Open input assistant to select a symbol.

Command Cross Reference List 6:

Find cross-references: The search is performed.

Command Cross Reference List 7:

Define columns in which to search for the string

Filter
(input field)

String to be searched for in the selected columns

The found locations are marked in yellow. Cross-references without this string are hidden.

Command Cross Reference List 8:

Show the source position of the previous cross-reference

Command Cross Reference List 9:

Show the source position of the next cross-reference

Command Cross Reference List 10:

Restrict results to current declaration

Available when multiple declarations are found for a symbol. Limits the display to the declaration you have just selected in the list.

Command Cross Reference List 11:

Show source position of the selected cross-reference: The focus jumps to the symbol's usage location.

Command Cross Reference List 12:

Print Cross Reference List: The standard dialog for setting up a print job appears.

Table of cross-references found

Symbol

The locations for the symbols (variables, POUs, DUTs) are grouped according to their declaration. The declaration location forms the root node, the usage points in the project appear indented below it. The system displays the exact expression, which the symbol has at the point of use.

Example: If there is a global variable "nVar" in the project and a locally declared variable "nVar" in a function block, then after a text search for the cross-references two root node entries appear in the list, and the respective point of use of variable "nVar" is shown below.

Function block

Function block name, DUT name; also task name in case of a function block call in the task configuration, for example.

Variable

Pure variable name. Example: "nVar".

Access

Type of access to the variable at the point of use:
Declaration / Read / Write / Call.

Special case for pointers: An assignment of the type pSample := ADR(nVar1) is displayed as Write | Address when searching for "nVar1". Reason: Any write accesses to "pSample" are not displayed when searching for "nVar1". Write accesses are also possible via the pointer variable.

Context

Context of the use of the variables.

Example: "nVar := 1"

Type

Data type of the variable.

Address

IEC address, if assigned to the variable.

Example "AT%QB0"

Position

Position of the usage location within the editor of the POU concerned: for example, line number, network number, declaration part, or implementation part.

Example: "Line 1, column 1 (Impl)" or "Line 9 (Decl)".

Object

POU name + in square brackets the complete path of the point of use.

Example: "MAIN [TwinCAT_SampleProject: PLC: SamplePLCProject]"

Comment

Comment, if present in the variable declaration.

The search returns all locations in the project as well as in inserted, uncompiled libraries.

Commands in the context menu of the Cross Reference List

Display source code position

Opens the affected function block and marks the usage location: for root entries the declaration, for child entries below it the respective usage location. Alternatively, you can double-click on a line.

Restrict results to current declaration

Limits the display of results to the selected symbol declaration in case of multiple found declarations.

Expand All

The list shows all the individual locations.

Collapse All

The list only shows the root nodes of all locations.

See also: