Introduction

Add to My manuals
704 Pages

advertisement

Introduction | Manualzz

Move/Logical Instructions (MOV, MVM, BTD, MVMT, BTDT, CLR, SWPB, AND, OR, XOR, NOT, BAND, BOR, BXOR, BNOT) Chapter 7

Boolean AND (BAND)

The BAND instruction logically ANDs as many as 8 boolean inputs.

To perform a bitwise AND, see page 303 .

Operands:

Structured Text

IF operandA AND operandB THEN

<statement>;

END_IF;

Use AND or the ampersand sign “&” as an operator within an expression.

The operands must be BOOL values or expressions that evaluate to BOOL values. This expression evaluates whether operandA and operandB are both set

(true).

See Appendix B for information on the syntax of expressions within structured text.

Function Block

Operand

BAND tag

Type

FBD_BOOLEAN_AND

Format

structure

Description

BAND structure

Input Parameter

EnableIn

Data Type

BOOL

In1

In2

In3

In4

In5

In6

BOOL

BOOL

BOOL

BOOL

BOOL

BOOL

FBD_BOOLEAN_AND Structure

Description

Enable input. If cleared, the instruction does not execute and outputs are not updated.

Default is set.

First boolean input.

Default is set.

Second boolean input.

Default is set.

Third boolean input.

Default is set.

Fourth boolean input.

Default is set.

Fifth boolean input.

default is set.

Sixth boolean input.

Default is set.

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

317

Chapter 7 Move/Logical Instructions (MOV, MVM, BTD, MVMT, BTDT, CLR, SWPB, AND, OR, XOR, NOT, BAND, BOR, BXOR, BNOT)

Input Parameter

In7

In8

Data Type

BOOL

BOOL

Output Parameter

EnableOut

Out

Data Type

BOOL

BOOL

Description

Seventh boolean input.

Default is set.

Eighth boolean input.

Default is set.

Description

Enable output.

The output of the instruction.

postscan

Description:

The BAND instruction ANDs as many as eight boolean inputs. If an input is not used, it defaults to set (1).

Out = In1 AND In2 AND In3 AND In4 AND In5 AND In6 AND In7 AND In8

Arithmetic Status Flags:

not affected

Fault Conditions:

none

Execution:

Condition

prescan instruction first scan instruction first run

EnableIn is cleared

EnableIn is set

Function Block Action

No action taken.

No action taken.

No action taken.

EnableOut is cleared.

The instruction executes.

EnableOut is set.

No action taken.

Example 1:

This example ANDs bool_in1 and bool_in2 and places the result in

value_result_and.

1

1

If BOOL_IN1 Is If BOOL_IN2 Is Then VALUE_RESULT_AND Is

0

0

0

1

0

0

0

1

0

1

Structured Text

value_result_and := bool_in1 AND bool_in2;

318

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

Move/Logical Instructions (MOV, MVM, BTD, MVMT, BTDT, CLR, SWPB, AND, OR, XOR, NOT, BAND, BOR, BXOR, BNOT) Chapter 7

Function Block

Example 2:

If both bool_in1 and bool_in2 are set (true), light1 is set (on). Otherwise, light1 is cleared (off).

Structured Text

IF bool_in1 AND bool_in2 THEN

ELSE light1 := 1; light1 := 0;

END_IF;

Publication 1756-RM003K-EN-P - July 2008

Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com

319

advertisement

Related manuals

advertisement

Table of contents