When are parentheses required FTVS expressions?

JZerb

Member
Join Date
Oct 2016
Location
Here
Posts
423
title says it all. at what point in time are ( ) required when writing expressions in FTVS? is it only when you want to 'look' at things it groups.

ex. (tagA>2 and tagB>4) or (tagC<5 and tagD<8)

written as above tags A,B both need to be greater then 2 and 4 respectively OR tags C,D need to be less then 5 and 8 respectively. then the expression would evaluate as TRUE. what if the parentheses are removed, would it still look at the expression in the same manner?
 
Apparently and has a higher precedence to or.
Comparisons are even lower than and and or

Examples: Evaluation order
For these examples, tag1 = 5, tag2 = 7, and tag3 = 10.
_____________________________
(tag1 > tag2) AND (tag1 < tag3)
is evaluated in this sequence:
1. tag1 > tag2 = 0
2. tag1 < tag3 = 1
3. 0 AND 1 = 0
The expression evaluates to 0 (false).
_____________________________
tag1 > tag2 AND tag3
is evaluated in this sequence:
1. tag2 AND tag3 = 1
2. tag1 > 1 = 1
The expression evaluates to 1 (true).
_____________________________
NOT tag1 AND tag2 > tag3 ** 2
is evaluated in this sequence:
1. NOT tag1 = 0
2. 0 AND tag2 = 0
3. tag3 ** 2 = 100
4. 0 > 100 = 0
The expression evaluates to 0 (false).
 

Similar Topics

Hi everyone id like to start by saying im not a PLC programmer so my technical terminology is limited. i would like advice on what software is...
Replies
4
Views
305
Hi all. Please can anyone assist me with a Devicenet EDS File or link for a Numatics G2-2 solenoid valve bank. Need to do configuration on a...
Replies
3
Views
718
Hello everyone. I am working on a rebuilt AB-Ultra series drive (1998) and the firmware for the drive is needed to test and use the drive. I would...
Replies
0
Views
458
Hello everyone, We are trying to upgrade a GE FANUC 9030 PLC, but we are having trouble extracting the program from it. LogicMaster90 is able...
Replies
6
Views
1,310
Hi , Does anyone have any pdf or manual on the GEM 80 Gemlan T card Could you let me know Many thanks Mike
Replies
0
Views
400
Back
Top Bottom