1. List average AVE/AVED/AVEF

ในหน้านี้6 หัวข้อ

1.1. Instruction description#

The Average Value of Single word List (AVE) instruction calculates the average value of all values in the list and outputs it to RES. The Average Value of Double Character List (AVED) calculates double characters, while the Average Value of Floating Point List (AVEF) calculates floating points.

Calculate the average of integers, and then round down the final value

For example, AVE D10 D0 K5 calculates the average of all values from D10 to D14 and stores it in D0.

List average

图1 List average

1.2. The valid operands of the instruction#

1.2.1. Average Value of Single word List(AVE)#

Input/Output Data Type operand Description
T 16 bit integer D List
RES 16 bit integer D/CV/TV/AO/V/Z, bit composite word (Y/M/C/T/S), local variable (LW) result
N 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) length

1.2.2. Average Value of Double Word List(AVED)#

Input/Output Data Type operand Description
T 32-bit integer D List
RES 32-bit integer D/CV, bit composite word (Y/M/C/T/S), local variable (LD) result
N 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) length

1.2.3. Floating List Average(AVEF)#

T 32-bit Real Number D List
RES 32-bit real number D, local variable (LF) result
N 16 bit integer D/CV/TV/AI/AO/K/H/V/Z/FD, bit composite word (X/Y/M/C/T/S), local variable (LW) length

1.3. Example#

command table:

NETWORK 000

LDP X000

AVE D10 D0 K5  // Calculate the value of (D10+D11+D12+D13+D14)/5 and store it in D0.

AVE

图2 AVE

อุปกรณ์ที่ใช้กับคู่มือนี้
2 รายการ
FAT-16MT-DC-E
FAT-16MT-DC-E

PLC 16 I/O 24V DC Transistor Output รองรับ Modbus RTU/RS485 TCP/IP

฿2,590

FAs-32MR-AC-E
FAs-32MR-AC-E

PLC 32 I/O 220V AC Relay Output รองรับ Modbus RTU/RS485 TCP/IP

฿3,690