You get a bonus - 1 coin for daily activity. Now you have 1 coin

contact addressing

Lecture



Overview

Many LAD commands work with one or several addresses (operands). This operand defines a constant or a place where a command finds a variable with which it performs a logical operation. This place can be a bit, byte, word or double word. Possible operands, for example, are:

  • constant, timer or counter value, or ASCII string
  • bit in the status word of the programmable logic controller
  • data block and memory cell inside data block area

You can apply direct addressing (setting a constant as an operand) or direct addressing (setting a variable as an operand).

contact addressing IN1- is direct addressing.
IN2- direct addressing

Constant formats for direct addressing can be found here.

Types of addresses

The address of the LAD command can point to one of the following objects:

  • bit, the signal state of which must be polled
  • bit that is assigned the signal state of a logic operation chain
  • bit, which is assigned the result of a logical operation (RLO)
  • bit that must be set or cleared
  • number indicating the counter to be increased or decreased
  • a number indicating which timer should be used
  • memory bit (measurer) of the front, preserving the previous result of a logical operation (RLO)
  • bit of memory (measurer) of the front, preserving the previous signal state of another operand
  • a byte, word, or double word containing the value with which the element and the LAD block should operate Bytes, a word or double word containing the value with which the element and the LAD block should operate.
  • the number of the data block (DB or DI) to be opened or created
  • the number of the function to be called (FC), system function (SFC), function block (FB) or system function block (SFB)
  • label to go to

Address IDs

Variables used as addresses consist of an address identifier and an address within the memory area specified in the address identifier. The address identifier can belong to one of the following two types:

  • An address identifier that indicates the following:
    • The memory area in which the command finds the value (data object) with which the operation must be performed (for example, I for the memory area of ​​the process image inputs)
    • The size of the data object with which the command must perform an operation (for example, B for byte, W for word and D for double word)
  • An address identifier that indicates the area of ​​memory, but not the size of the data object in this area (for example, an identifier that indicates the area T for a timer, C for a counter, DB or DI for a data block, plus the number of the timer, counter, or data block).

Pointers

A pointer is an element that recognizes the location of the ariable variable. The pointer contains an address instead of a value. When assigning an actual parameter to the parametric type “pointer”, you specify an address in memory. STEP 7 allows you to enter a pointer either in pointer format or simply as an address (for example, M 50.0). The following is an example of a pointer format for accessing data starting with M 50.0: P # M50.0

Working with a word or double word as a data object.

If you work with a command whose address identifier defines the memory area of ​​your programmable logic controller, and with a data object that is either a word or a double word in size, then you should take into account that the memory address is always referred to as a byte address. This byte address is the smallest byte number or the highest byte number. For example, the address in the statement shown in the figure below refers to four consecutive bytes in the memory area M, starting with byte 10 (MB10) and up to byte 13 (MB13).

contact addressing

contact addressing Here are the objects of the following sizes.

Double word: double word memory MD10
Word: words of memory MW10, MW11 and MW12

Byte: MB10, MB11, MB12 and MB13 memory bytes

If you are using absolute word size or double word addresses, then make sure that you avoid such byte assignments that they overlap.


Comments


To leave a comment
If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Contact Programming / LAD

Terms: Contact Programming / LAD