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...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Compute/Math <strong>Instructions</strong> (CPT, ADD, SUB, MUL, DIV, MOD, SQR, SQRT, NEG, ABS) 267Example 1:Divide float_value_1 by float_value_2 and place the result individe_result.Relay LadderStructured Textdivide_result := float_value_1 / float_value_2;Function BlockExample 2:The DIV and MOV instructions work together to divide two integers,round the result, and place the result in an integer tag:• The DIV instruction divides dint_a by dint_b.• To round the result, the Destination is a REAL tag. (If thedestination was an integer tag (SINT, INT, or DINT), theinstruction would truncate the result.)• The MOV instruction moves the rounded result (real_temp) fromthe DIV to divide_result_rounded.• Since divide_result_rounded is a DINT tag the value fromreal_temp is rounded and placed in the DINT destination.Relay Ladder43009Publication 1756-RM003I-EN-P - January 2007

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

Saved successfully!

Ooh no, something went wrong!