How to use Mitsubishi PLC accumulation instruction

Publisher:Jinyu2022Latest update time:2024-10-18 Source: elecfansKeywords:Mitsubishi Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Mitsubishi PLC (Programmable Logic Controller) is a controller commonly used in the field of industrial automation. The accumulation instruction is a basic instruction in PLC programming, which is used to accumulate data. In Mitsubishi PLC, the accumulation instruction is usually implemented using the ADD instruction. The following is a detailed introduction to Mitsubishi PLC accumulation instructions.

  1. Basic concepts of accumulation instructions

The accumulation instruction is an instruction that performs a sum operation on data, that is, adding two or more data and storing the result in a specified register. In Mitsubishi PLC, the accumulation instruction is usually implemented using the ADD instruction.

  1. Syntax of the Accumulate instruction

In Mitsubishi PLC, the basic syntax of the accumulation instruction is as follows:

ADD XYZ

Where X, Y, and Z are operands, which can be registers or constants. X is the first operand, Y is the second operand, and Z is the result register. After the accumulate instruction is executed, the sum of X and Y will be stored in Z.

  1. Types of Accumulate Instructions

There are several types of accumulation instructions in Mitsubishi PLC:

3.1 Single byte accumulation (ADD)

Single-byte accumulation is the most basic accumulation instruction, which is used to add two single-byte data. For example:

ADD D0 K1 D1

This instruction adds the value in the D0 register with the constant 1 and stores the result in the D1 register.

3.2 Double Byte Accumulation (ADDW)

Double-byte accumulation is used to add two double-byte data. For example:

ADDW D0 D2 D4

This instruction adds the values ​​in the D0 and D2 registers and stores the result in the D4 register.

3.3 Three-byte accumulation (ADDD)

Three-byte accumulation is used to add two three-byte data. For example:

ADDD D0 D2 D4

This instruction adds the values ​​in the D0, D1, and D2 registers and stores the result in the D4, D5, and D6 registers.

3.4 Four-byte accumulation (ADDL)

Four-byte accumulation is used to add two four-byte data. For example:

ADDL D0 D2 D4

This instruction adds the values ​​in the D0, D1, D2, and D3 registers and stores the result in the D4, D5, D6, and D7 registers.

  1. Application scenarios of accumulation instructions

Accumulation instructions are widely used in the field of industrial automation. The following are some common application scenarios:

4.1 Counter

In a counter, the accumulation instruction can be used to accumulate the count value of the counter. For example, you can use the accumulation instruction to add the current value of the counter to a constant and then store the result in the counter.

4.2 Flow meter

In a flow meter, the totalization instruction can be used to calculate the total flow of a fluid. The total flow of the fluid can be obtained by multiplying the instantaneous flow of the flow meter by a time interval and then adding the result to the total flow.

4.3 Temperature control

In a temperature control system, the accumulation instruction can be used to calculate the total change in temperature. The total change in temperature can be obtained by multiplying the temperature sensor reading by a time interval and then adding the result to the total change.

4.4 Material weighing

In a material weighing system, the accumulation instruction can be used to calculate the total weight of the material. The total weight of the material can be obtained by multiplying the reading of the weighing sensor by a time interval and then adding the result to the total weight.

  1. Notes on the Accumulate Instruction

When using the accumulation instruction, you need to pay attention to the following points:

5.1 Overflow Handling

When performing an accumulation operation, if the result exceeds the storage range of the register, an overflow will occur. To avoid overflow, you need to select a suitable register type or perform overflow checks during programming.

5.2 Data Types

When performing an accumulation operation, you need to ensure that the data types of the operands are consistent. For example, you cannot accumulate an integer and a floating point number.

5.3 Result Accuracy

When performing accumulation operations, you need to pay attention to the precision of the result. If you need a high-precision result, you can use floating-point numbers for accumulation.

5.4 Register Address

When using the accumulation instruction, you need to ensure the correctness of the register address. If the wrong register address is used, the program may run abnormally.


Keywords:Mitsubishi Reference address:How to use Mitsubishi PLC accumulation instruction

Previous article:Correct wiring method for inverter filter
Next article:How to program Mitsubishi PLC cumulative running time

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号