Skip to main content

Command: Cross Reference List

Symbol: _cds_icon_cross_references.png

Function: The command opens the Cross Reference List view.

Call: View menu; Edit → Browse → Display Cross References

The view shows a list of cross references for a symbol in the project. The symbol can be a variable, a POU (program, function block, function), or a custom data type (DUT). The cross reference list provides two basic types of searches:

  • Text search: By specifying a symbol name, the cross references of all symbols in the project are displayed with their names. If multiple symbols with the same are found, then the context menu can be used to restrict the display to individual declarations.

  • Declaration search: The symbol can be selected by means of the Input Assistant or by specifying a qualified path (for example, Device.Application.PLC_PRG.i or __POOL.POU.a). After that, the occurrence locations of this symbol are displayed, even if other symbols with the same name exist.

Input field

. Symbol name (variable name, POU name, DUT name) – Input possibilities:
  • Selection of a declared symbol by means of the Input Assistant (_cds_icon_crossref_symbol_from_input_assistant.png button)

  • Manual input of the symbol name

    Triggering of the search by pressing the _cds_icon_show_next_location.png button or the Enter key

    For the text search, you can use the placeholders "*" (any number of characters) or "?" (exactly any one character) in combination with a partial string of a variable identifier.

    Use the percent sign "%" to search for IEC addresses.

    Examples: "%MW8", "%M*"

  • Use the Browse → Display Cross References command if the name of a declared symbol is selected in an editor, or if the cursor is in the name field. A search is also possible if the object is selected in the device tree or POU pool.

  • Automatic if the name of a declared symbol is selected in an editor, or if the cursor is in the name field

    An automatic search is also possible if the object is selected in the device tree or POU pool.

    Requirement: The Automatically list selection in cross reference view option is selected in the SmartCoding category of the CODESYS Options.

. The following input is valid:
  • Variable name; simple or qualified

    Examples: "iVar", "PLC_PRG.iVar"

  • POU name

    Examples: "PLC_PRG", "myFB"

  • DUT name

    Example: "mySTRUCT"

  • Strings combined with placeholders "*" (any number of characters) or "?" (exactly one character)

    Example: "iVar*" applies to iVar1, iVar_glob2, iVar45, etc.

    "iVar?" applies to iVar1, iVar2, iVarX, etc., but not iVar_glob2, iVar45, etc.

  • "%IEC <address>": CODESYS searches for variables which are assigned to this address and direct memory access.

    Example: "%QB0", %Q0 := 2

_cds_icon_cross_reference_search.png

Open the Input Assistant for selecting a symbol

_cds_icon_go.png

Perform search

_cds_icon_filter.png

Define columns to search for the string

Input field

String which is searched for in the selected columns

The result locations are highlighted in yellow. Cross references without this string are hidden.

_cds_icon_crossref_source_pos_next.png

Show source position of previous cross reference (Shift+F4)

_cds_icon_crossref_source_pos_previous.png

Show source position of next cross reference (F4)

_cds_icon_limit_to_declaration.png

Limit Results to Current Declaration

Available when multiple declarations have been found for a symbol

Restricts the display to the declaration that you have selected in the list

_cds_icon_crossref_go_to_source_position.png

Show source position of selected cross reference

The focus jumps to the occurrence location of the symbol.

cds_icon_cross_ref_print.png

Print cross reference list

The default dialog for setting up a print job opens.

The cross references are displayed with the following information:

Symbol

The result locations for the symbols (variables, POUs, or DUTs) are grouped by declaration. The declaration occurrence comprises the root node and the occurrence locations in the project are indented below. Exactly that expression is displayed which has the symbol at the occurrence location.

Example: If there is a global variable i in the project and a local declared variable i in a POU, then two root node entries will be listed after a text search for cross references with the occurrences of the variable i below each.

POU

POU name, DUT name; also for example a task name in the case that a POU call is in the task configuration

Variable

Purely a variable name

Example: iVar

Access

Type of access to the variable at the occurrence location: Declaration / Read / Write / Call

Special case for pointers

An assignment of type p := ADR(var1) is displayed as Write | Address when searching for var1. The reason for this is that any write access to p is not displayed when searching for var1. Write access is also possible by means of pointer variables.

Type

Data type of the variable

Address

IEC address in the case that variables are assigned

Example: "AT %QB0"

Position

Location of the occurrence in the POU editor, for example line number, network number, declaration part, or implementation part

Example: "Line 1, Column 1 (Impl)"

Object

POU name plus full path of the occurrence location in brackets (in the case that this is found in the Devices view)

Example: "PLC_PRG [Device:Plc Logic:Application]"

Comment

Comment in the case that it is available in the declaration of the variable

The search yields all result locations in the project and in integrated, uncompiled libraries.

Commands in the context menu of the cross reference list

Show Source Position: Opens the respective POU and marks the occurrence: for root entries, the declaration, and for subordinate entries, the respective occurrence location. Alternatively, you could also double-click a line.

Limit Results to Selected Declaration: Limits the display of results to the selected symbol declaration if multiple declarations are found

Expand All: In the list, every single result location is shown.

Collapse All: In the list, only the root nodes of the result locations are shown.

For more information, see: Using the Cross Reference List to Find Occurrences