32.16.2.6 System Variables Indicating Execution Results - AVE/AVEP

Program Example

AVE

Averages 1 through 5 in Data_1 and saves the result in Data_2.

  1. When the positive transition instruction turns ON, the AVE instruction will be executed. When the AVE instruction is executed, the average of array elements 0 through 4 of Data 1 are calculated and the result at D1 is stored in Data_2.
    When using a normally-open instruction, as long as the instruction variable is ON, the AVE instruction is always executed.

    Array Variable Name

    Data 1

    5 Executed Instructions

    Save in

    Data 2

    Element

    Data_1[0]

    + ÷5

    Data_2[0]

    Data_1[1]

    + ÷5

    Data_2[1]

    Data_1[2]

    + ÷5

    Data_2[2]

    Data_1[3]

    + ÷5

    Data_2[3]

    Data_1[4]

    + ÷5

    Data_2[4]

    Data_1[5]

     

     

    Data_2[5]

    Data_1[6]

     

     

    Data_2[6]

    Data_1[7]

     

     

    Data_2[7]

    Data_1[8]

     

     

    Data_2[8]

    Data_1[9]

     

     

    Data_2[9]

    Data_1[10]

     

     

    Data_2[10]

AVEP

  1. When to run the instruction is different between AVE and AVEP instructions. The AVEP instruction only detects the upward transition and executes the AVEP instruction even when using a normally open instruction. As a result, even if the instruction is always on, the AVEP instruction is executed only for one scan.