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.
-
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.
-
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.
-
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.
-
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.
-
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.
Previous article:Correct wiring method for inverter filter
Next article:How to program Mitsubishi PLC cumulative running time
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- What kind of professional title can be awarded to software engineering graduates in 2013 to be considered professionally matched?
- Learn Wi-Fi 6 in one article
- Wireless battery charger design is too complicated? Try the emotional approach
- Software Design of CPU Card
- Nearly 500 million people in China don’t use the Internet?
- Shoot-n-Loot: A game written in Ada
- TMS320C6748_UART(1) - Basic knowledge
- What do you think of "It is not recommended to add vias on SMD pads"
- About the problem of optocoupler clicking screen
- Today at 10:30 AM Live Broadcast [Microchip Embedded Security Solutions | Firmware Verification Using TrustFLEX Secure Element]