F_BA_CompareVersion

F_BA_CompareVersion 1:

The function F_BA_CompareVersion of return type BOOL compares two version numbers stVersion1 and stVersion2, each of type ST_BA_Version. The input variable nLimit specifies how many digits are to be compared, starting with 1 = "Major". The enumeration eCompare specifies the comparison operation. The function return value changes to TRUE if the comparison is fulfilled.

For example, if stVersion1 is lower than stVersion2, then the comparison eCompare = E_BA_CompareMode.eLower returns a TRUE as function return.

Syntax

FUNCTION F_BA_CompareVersion : BOOL
VAR_INPUT
  stVersion1  : ST_BA_Version;
  stVersion2  : ST_BA_Version;

  eCompare    : E_BA_CompareMode  := E_BA_CompareMode.eEqual;
  nLimit      : UINT(1 .. 4)      := 4;  
END_VAR

F_BA_CompareVersion 2: Inputs

Name

Type

Description

stVersion1, stVersion2

ST_BA_Version

Version numbers to be compared.

eCompare

E_BA_CompareMode

Comparison operation to be performed.

nLimit

UINT(1 ... 4)

Number of digits to be compared, starting with "Major".

Requirements

Development environment

Required PLC library

TwinCAT 3.1 4024.35

Tc3_BA2_Common from V2.1.20.0