12.07.2015 Views

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Structured Text Programming 669Use bitwise operatorsBitwise operators manipulate the bits within a value based ontwo values.For Use This Operator Optimal Data Typebitwise AND &, AND DINTbitwise OR OR DINTbitwise exclusive OR XOR DINTbitwise complement NOT DINTFor example:Use This Formatvalue1 operator value2ExampleFor This SituationIf input1, input2, and result1 are DINT tags and yourspecification says: “Calculate the bitwise result ofinput1 and input2. Store the result in result1.”You’d Writeresult1 := input1 ANDinput2;Determine the order of executionThe operations you write into an expression are performed in aprescribed order, not necessarily from left to right.• Operations of equal order are performed from left to right.• If an expression contains multiple operators or functions, groupthe conditions in parenthesis "( )" . This ensures the correctorder of execution and makes it easier to read the expression.OrderOperation1. ( )2. function (…)3. **4. − (negate)5. NOT6. *, /, MOD7. +, - (subtract)8. =9. =, 10. &, AND11. XOR12. ORPublication 1756-RM003I-EN-P - January 2007

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!