Defining variables

Return to Introduction  Previous page  Next page

 

You can define and use variables in different ways

 

 

 

fingerVariables can be referred using two kinds of representation: Direct Memory addressing and TAG Names . A direct memory addressing is done entering a string which begins with the '%' character and directly refers to a resource into the PLC. A TAG Name is a "mnemonic" name you use to "Abstract" a physical or logical resource of your PLC.

 

 

 

A) Use of a Direct Memory Address %...

LadderDIP PLC Studio supports standard IEC/CEI 1131-3 variable notation which can be used simply typing this kind of identificator in the REFERENCE field of the I/O components ( I/0 blocks and variable blocks )

 

Some examples

 

%MW3

Uses the 16-bits word number three

Note : Variables are numbered from zero [0..n-1]

%QX2.3

Uses the OUTPUT port located in the bit#3 of the word#2

%IX0.5

Uses the INPUT port assigned to the bit#5 of the word#0

 

B) Defining a TAG name (Identifier)

 

A TAG Name is a "mnemonic" or an identifier that you use instead of a direct memory addressing and it works like a sort of "Abstraction" between a well readable and understandable name and a real physical resource of the PLC. Often is useful to have in a diagram a name like "GEAR" or "STOP_ENGINE" instead of a string like %MW56.6.

 

Accessing Options menu_navigate_arrowConfiguration from the menu and selecting the Variables tab you can access a table where you can add and edit your Tag Names. If you want, for example, to add a Tag named "ENGINE_ON" which should refer to the physical address %QX2.5, press the Add button and enter the TAG name into the new "Variable Name" column field and the address in the Address field. Then press the OK button to confirm changes.

 

ide_dialog_configuration_variables

 

Once you defined a TAG name you can use it in all the I/O blocks and memory access blocks. This is simply done applying the desired resource in the REFERENCE field