How to Enter Addresses in LAD (GS 3.5)

When you enter an instruction in LAD, the parameters are initially represented by question marks, like this (??.?) or this (????).

The question marks indicate that the parameter is unassigned. You can assign a constant value or an absolute, symbolic, or variable address for the parameters of the element when you enter it, or you can come back later. Your program will not be compiled properly if any parameters remain unassigned.

Assigning Addresses

To assign a constant value (such as 100) or an absolute address (such as I0.1), simply type the desired value in the address area of the instruction. (Use the mouse or the ENTER key to select the address area for typing.)

To assign a symbolic address (a global symbol or local variable that uses a name such as INPUT1), you must perform the following simple steps:

1.Type the symbol or variable name in the address area of the instruction.

2.For Global Symbols, use the Symbol Table/ Global Variable Table to assign a symbol name to a memory address.

Note: You do not have to pre-define symbols in order to use them in your program. You can define memory addresses later.

For Local Variables, use the Local Variable Table at the top of the program editor window. Enter the symbol name in the "Name" column. You do not enter an address for a local variable because the compiler automatically assigns L memory addresses. You can minimize the size of the Local Variable Table by dragging the table edge.

The use of local variables is an advanced programming technique. Inexperienced programmers should consider assigning all symbolic values as global symbols in the Symbol Table/Global Variable Table.

Tip: The Program Editor automatically formats address values after you enter them. You do not need to type the formatting characters; they will appear in the display after you finish typing.

Examples Of How The Program Editor Displays Addresses

I0.0 Absolute address is designated by memory area and address number (SIMATIC program editor)
%I0.0 Percent sign precedes an absolute address in IEC (IEC program editor)
#INPUT1 Pound symbol precedes a local variable (SIMATIC or IEC program editor)
INPUT1 Global symbol name (SIMATIC or IEC program editor)
??.? or ???? Red question marks indicate an undefined address (must be defined before program is compiled)

Matching Addresses and Defining Symbols

When you right-click on a parameter of an instruction, the pop-up menu allows you to quickly define the address in the symbol table or select from up to five possible matches based on what has already been typed in the address area.

Tips:

ĚUse the ENTER key to cycle through all the instructions of a network, one parameter at a time, in order to quickly edit any necessary addresses.

ĚAlternatively, select individual parameters by right-clicking, and define symbols or find matches for those addresses by using the pop-up menu.

Valid and Invalid Symbolic Names

Symbolic names are permitted to contain alphanumeric characters and underscores. They are also permitted to contain extended characters (ASCII 128 to ASCII 255). The first character is restricted to alpha and extended characters only.

Valid names: Illegal names:
a11 1loop
a_b_1_2 l:kdl";ld
└┴˝˛ËŮ▀Ř_1284938  

So illegal names are ones that begin with a number or contain characters that are not alphanumeric or in the extended character set.

See Also:

How the Program Editor Shows Entry Errors in LAD (GS 3.9)

Addressing Overview (GS 2.2)

Constants

Select Mnemonic Set

Subroutine

Interrupt