Data processing instructions include batch reset instructions, encoding and decoding instructions, and average value calculation instructions. Among them, batch reset instructions can be used to initialize the data area, and encoding and decoding instructions can be used to compile a bit code that is set to 1 in a word component. A brief introduction is given below.
(1) Section reset command
The instruction mnemonic, instruction code, operand range, and program steps are shown in the table.
Section reset command element table
Command name | Mnemonics | Instruction code bits | Operand range | Program Step | |
D1 ( . ) | D2 ( . ) | ||||
Zone reset |
Z
RS
T
ZRST(P) |
FNC40 ◥
(16) |
T 、 M 、 S 、 T 、 C 、 D (D1 ≤ D2) | ZRST, ZRSTP…5 steps | |
|
|
|
|
|
|
The interval reset instruction is also called the batch reset instruction, and its use is shown in the figure. When M8022 changes from OFF to ON, the interval reset instruction is executed. Bit components M500~M599 are reset in batches, word components C235~C255 are reset in batches, and state components S0~S127 are reset in batches.
The components specified by the target operands [D1] and [D2] should be of the same type, and the component number specified by [D1] should be less than or equal to the component number specified by [D2]. If the component number of [D1] is greater than the component number of [D], only the component specified by [D1] is reset.
This instruction is a 16-bit operation, but a 32-bit counter can be specified in [D1][D2]. However, they cannot be mixed, that is, a 16-bit counter cannot be specified in [D1] and a 32-bit counter cannot be specified in [D2].
Figure 8-23 Instructions for using the ZRST interval reset instruction
(2) Decoding instructions
The instruction mnemonic, instruction code, operand range, and program steps are shown in the table.
Decoding instruction element table
Command name | Mnemonics | Instruction code bits | Operand range | Program Step | ||
S ( . ) | D ( . ) | n | ||||
decoding |
DECO
DECO(P) |
FNC38 ◥
(16) |
K 、 H
X 、 Y 、 M 、 S T 、 C 、 D 、 V 、 Z |
Y 、 M 、 S
T 、 C 、 D 、 |
K 、 H
1≤n≤ 8 |
DECO, DECOP…7 steps |
(a) When [D] is a bit element, the decimal code value represented by the n-bit continuous bit element with source [S] as the first address is Q. The DECO instruction sets the Qth bit (excluding the target element bit itself) of the target element with [D] as the first address to 1, and the other bits to 0. As shown in the figure, the source data Q=20+21=3, so the third bit M13 starting from M10 is 1. When the source data Q is 0, the 0th bit (i.e. M10) is 1.
If n=0, the program will not be executed; if n=other than 0~8, an operation error will occur. If n=8, the number of bits of [D] is 28=256. When the drive input is OFF, the instruction will not be executed, and the bit set to 1 in the last decoding output will remain unchanged.
If the instruction is of continuous execution type, it will be executed in each scan cycle, so please pay attention.
(b) When [D] is a word element, the decimal code Q represented by the lower n bits of the word element specified by the source [S], the DECO instruction sets the Qth bit (excluding the lowest bit) of the target word element specified by [D] to 1, and the other bits to 0. Explanation As shown in Figure 8-24 (b), the source data Q=20+21=3, so the third bit of D1 is 1. When the source data is 0, the 0th bit is 1.
If n=0, the program will not be executed; if n=other than 0~4, an operation error will occur. If n=4, the number of bits of [D] is 24=16. When the drive input is OFF, the instruction will not be executed, and the bit set to 1 in the last decoded output will remain unchanged.
The application of DECO instruction is shown in the figure. According to the value stored in D0, the same address number of M combination element is connected. The value of 0~15 is stored in D0. Take n=K4, then corresponding to the value of D0 (0~15), M0~M15 has a corresponding 1 point connected.
If n changes between K1 and K8, it can correspond to the value of 0 to 255. However, the soft element range of the target required for decoding is occupied, so be careful not to reuse it for other controls.
(3) Encoding instructions
The instruction mnemonic, instruction code, operand range, and program steps are shown in the table.
Table of elements for coded instructions
Command name | Mnemonics | Instruction code bits | Operand range | Program Step | ||
S ( . ) | D ( . ) | n | ||||
coding |
ENCO
ENCO(P) |
FNC42 ◥
(16) |
X 、 Y 、 M 、 S
T 、 C 、 D 、 V 、 Z |
T 、 C 、 V 、 Z 、 D 、 |
K 、 H
1≤n≤ 8 |
ENCO, ENCOP...7 steps |
(a) When [S] is a bit element, the bit element with the source [S] as the first address and a length of 2n, the highest position set to 1 is stored in the element specified by the target [D]. The value in [D] is determined by n. Explanation As shown in Figure 8-26 (a), the length of the source element is 2n=23=8 bits M10~M17, and the highest bit set to 1 is M13, which is the 3rd bit. The "3" position number (binary) is stored in the lower 3 bits of D10.
When the first (i.e., the 0th) bit element of the source number is 1, 0 is stored in [D]. When there is no 1 in the source number, an operation error occurs.
If n=0, the program will not be executed; if n=other than 1~8, an operation error will occur. If n=8, the number of bits of [S] is 28=256. When the drive input is OFF, the instruction will not be executed and the last encoding output will remain unchanged.
If the instruction is of continuous execution type, it will be executed in each scan cycle, so please pay attention.
(b) When [S] is a word element, the highest bit set to 1 in its readable length of 2n bits is stored in the element specified by the target [D]. The range of the value in [D] is determined by n. Explanation As shown in Figure 8-26 (b), the readable length of the source word element is 2n=23=8 bits, and the highest bit set to 1 is the 3rd bit. The "3" position number (binary) is stored in the lower 3 bits of D1.
When the first (i.e., the 0th) bit element of the source number is 1, 0 is stored in [D]. When there is no 1 in the source number, an operation error occurs.
If n=0, the program will not be executed; if n=other than 1~4, an operation error will occur. If n=4, the number of bits of [S] is 24=16. When the drive input is OFF, the instruction will not be executed and the last encoding output will remain unchanged.
If the instruction is of continuous execution type, it will be executed in each scan cycle, so please pay attention.
Previous article:Summary of the most complete PLC programming algorithm
Next article:Analysis of communication technology based on OPCUA and Siemens PLC
- 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.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [2022 Digi-Key Innovation Design Competition] - Introduction to the functions of the STM32F750N8H6 development board
- [NUCLEO-L452RE Review] + Example of sending the value received by the serial port to the message queue
- dds.pdf
- Switching Circuit Voltage Calculation
- Let your LED follow the MUSIC HIGH!
- 【Qinheng CH582】5 displays CPU temperature
- CC1310 Two-wire Serial Bootloader Solution
- 70 Years of Sky Heavy Equipment
- What should the circuit output waveform look like?
- Is there any simple circuit to convert potentiometer to PWM?