F_BA_ByteCmp

F_BA_ByteCmp 1:

The function F_BA_ByteCmp of return type DINT compares the contents of a memory area in byte steps with a compare byte nCompare.

As soon as a byte is found within the memory area that is lower in value than the comparison byte, the function aborts its comparison and assumes the return value "-1". If a byte is found that is greater than the comparison byte, the function also aborts and takes the return value "1". If, on the other hand, no difference is found, i.e. all bytes of the memory area to be examined are identical to the comparison byte, the function assumes the value "0" when the comparison is completed.

The input variable pValue marks the beginning of the memory area, the variable nSize the length.

In case of an incorrect input, i.e. pValue = 0 or nSize = 0, the function is also aborted immediately and takes "-1" as return value.

Syntax

FUNCTION F_BA_ByteCmp : DINT
VAR_INPUT
  pValue    : PVOID;
  nSize     : UXINT;
  nCompare  : BYTE;
END_VAR

F_BA_ByteCmp 2: Inputs

Name

Type

Description

pValue

PVOID

Pointer to the beginning of the memory area to be examined.

nSize

UXINT

Length of the memory area.

nCompare

BYTE

Comparison byte.

Requirements

Development environment

Required PLC library

TwinCAT 3.1 4024.35

Tc3_BA2_Common from V2.1.20.0