Structured Text; Function Block; Relay Ladder - Allen-Bradley Logix5000 Reference Manual

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

Chapter 6
Compute/Math Instructions (CPT, ADD, SUB, MUL, DIV, MOD, SQR, SQRT, NEG, ABS)
278

Structured Text

divide_result := float_value_1 / float_value_2;

Function Block

Example 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 the destination was
an integer tag (SINT, INT, or DINT), the instruction would truncate the
result.)
• The MOV instruction moves the rounded result (real_temp) from the
DIV to divide_result_rounded.
• Since divide_result_rounded is a DINT tag the value from real_temp is
rounded and placed in the DINT destination.

Relay Ladder

Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
43009

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents