Siemens PLC Learning note 11-(Loading and delivery instructions)

Source: Internet
Author: User

s7-300/400 directives are: load and transmit instruction, comparison instruction, arithmetic operation instruction, Word logic operation instruction, shift instruction, logic control instruction, program controlling instruction, master control command, etc.

1. Loading and delivery instructions (cannot be used for ladder diagram programming)

The load transfer instruction realizes the data exchange of various data stores, which is done by the accumulator. Mount instruction identifier: L, transfer instruction identifier: T.

The S7-300PLC has 2 32-bit accumulators, when the load instruction (L) is executed , first the data in the accumulator 1 is moved into the accumulator 2, the original content in the accumulator 2 is overwritten, and then the data is loaded into the accumulator 1, and when the transfer instruction (T) is executed, the The data in the accumulator 1 is written to the destination store, and the data in the accumulator 1 remains unchanged.

L instruction load number, accumulator value as shown:


The S7-400PLC has 4 32-bit accumulators, when the loading instruction (L) is executed , the accumulator 3 is first moved into the accumulator 4, the accumulator 2 is moved into the accumulator 3, the accumulator 1 is moved into the accumulator 2, and then the data is loaded into the accumulator 1, and when the transfer instruction (T) is executed, the data in the accumulator 1 is written to the destination store, and the data in the accumulator 1 remains unchanged.

L, t instruction use examples such as:



The following examples are used for the L and T directives:

L   IB0   //load the number of IB0 bytes into the accumulator 1T   QB0   //The number of accumulator 1 into QB0 bytes
This code enables the IB No. 0 byte of data to be reflected in real time to the QB No. 0 byte, that is, IB0.0 to 1,qb0.0 is also 1, the emulator output is as follows:

2. Loading and transmitting instructions between the status word and the accumulator 1

L STW (Load the status word into the accumulator 1): Load the status word into the accumulator 1, the execution of the instruction is independent of the status bit and has no effect on the status word.

T STW (transfer the contents of accumulator 1 to the status word): Use the t STW instruction to transfer the bit 0~8 of the accumulator 1 to the corresponding bit of the status word, and the execution of the instruction is independent of the status bit.

3.LAR1 load the contents of the operand into the address register AR1


4.TAR1 Transfer the contents of Address register 1 to the operand


5.tar2 The content of address register 2 to the operand (operand can be accumulator 1, storage double word (MD), local data double word (LD), data double Word (DBD), background data double word (DID))

6.CAR swap the contents of Address register 1 and address register 2, use the CAR instruction to exchange the contents of the address register AR1 and address register AR2, the instruction does not need to specify the operand. The execution of the instruction is independent of the status bit and has no effect on the status word.

7.LC (Timer/counter loading) instruction

The LC instruction can be used to save the contents of the accumulator 1 to the accumulator 2, the specified timer word in the current time value and times base in the BCD code (0~999) format into the accumulator 1, or the specified counter's current count value in the BCD code (0~999) format into the accumulator 1. Instruction format: LC< timer/Counter >

LC   T3   //The current time and time base of Timer 3 is loaded into the accumulator 1 Low character LC   C10  //The counter C10 count value is loaded into the accumulator 1 low word in BCD code format
8.MOVE instruction

This instruction is a function box in the form of a transfer instruction, the ability to copy byte, Word or double-word data objects. The in and out side operands in the application can be constants, I, Q, M, D, L, and so on, but must match on the width.






Siemens PLC Learning note 11-(Loading and delivery instructions)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.