DirectLOGIC PLCs - the most practical PLCs in the industry......from AutomationDirect go back to Do-more home AutomationDirect online store

Spend Less; Do More

Do-more™ PLC: Powerful, Intuitive Math Instruction

Watch a video about the Math Instruction

The Spreadsheet style MATH instruction allows mixing of data types* and it accepts formulas and variables. The MATH instruction also allows nesting with parentheses to 8 levels, plus:

  • Ten 'Real' Functions, including Natural Log, Log, e, PI, Square Root, and conversions
  • All the standard Trig Functions
  • Eight Statistical Functions, including Average, Min & Max, RANDINT and RANDREAL (to generate random values), Standard Deviation functions and more
  • Thirteen Conditional functions, including six CountIF, six SumIF, and If/Else expressions with a full complement of binary operators

If that's not enough, how about Absolute Value, Time, Memory, and Indirect addressing? You even get access to system-level bits such as $IndexError, $OutOfRange, $Overflow, etc.

* Note about data types: integer and real types are really all you need but Do-more does include a few BCD and octal conversion instructions for legacy data types.


 

Do-more Math Instruction

Do-more Math Instruction (above) used to evaluate the volume of liquid in a vertical cylindrical tank:
Math Equation - Tank Volume

Here is a list of ALL the operators and functions that can be used in the Math Instruction (from the Help file):

Binary Operators

Description

Example

+

Add

D0 + D1

-

Subtract

D0 - D1

*

Multiply

D0 * D1

/

Divide

D0 / D1

%

Modulus/Remainder

D0 % D1

**

Raise to a Power

D0 ** D1

<

Less Than

D0 < D1

<=

Less Than or Equal To

D0 <= D1

==

Equal To

D0 == D1

!=

Not Equal To

D0 != D1

>=

Greater Than or Equal To

D0 >= D1

>

Greater Than

D0 > D1

&&

Logical AND

X0 && X1

||

Logical OR

X0 || X1

&

Bit-wise AND

D0 & 0x7FFF

|

Bit-wise OR

D0 | 0xFFFF

^

Bit-wise XOR

D0 ^ D1

<<

Shift Left

D0 << 1

>>

Shift Right

D0 >> 1

>>>

Unsigned Shift Right

D0 >>> 1

 

Unary Operators

Description

Example

-

Negate

-D0

~

Bit-wise Invert

~D0

!

Logical Not

!X0

 

Common Functions

Description

Example

ABS

Absolute Value

ABS(D0)

MAX

Maximum Between Two Expressions

MAX(D0 * D1, V2)

MIN

Minimum Between Two Expressions

MIN(D0 * D1, V2)

 

REAL Functions

Description

Example

E

Euler's Constant e

E()

FRAC

Fractional Portion of a Real Number

FRAC(R0)

LN

Natural Log

LN(R0)

LOG

Log Base 10

LOG(R0)

PI

Returns the value of PI (3.14159)

PI()

ROUND

Round Real to Nearest Whole Number

ROUND(R0)

SQRT

Square Root

SQRT(R0)

TOINT

Convert to Integer

TOINT(SQRT(R0))

TOREAL

Convert to Real

TOREAL(D0 + D1)

TRUNC

Truncate Real to a Whole Number

TRUNC(R0)

 

Trigonometric Functions

Description

Example

ACOS

Arccosine in Radians

ACOS(R0)

ASIN

Arcsine in Radians

ASIN(R0)

ATAN

Arctangent in Radians

ATAN(D0)

COS

Cosine of Radian Angle

COS(R0)

DEG

Convert Radians to Degrees

DEG(R0)

RAD

Convert Degrees to Radians

RAD(R0)

SIN

Sine of Radian Angle

SIN(R0)

TAN

Tangent of Radian Angle

TAN(R0)

 

Statistical Functions

Description

Example

AVGR

Average of a Range of Values

AVGR(D0,10)

MAXR

Maximum Value Across a Range of Values

MAXR(D0,10)

MINR

Minimum Values Across a Range of Values

MINR(D0, 10)

RANDINT

Get Random Integer in Range 0 ... 2147483647

RANDINT()

RANDREAL

Get Random Real in Range 0.0 ... 1.0

RANDREAL()

STDEVPR

Population Standard Deviation of a Range

STDEVPR(R20, 8)

STDEVR

Sample Standard Deviation of a Range

STDEVR(R20, 8)

SUMR

Sum of a Range of Values

SUMR(D0,10)

 

Conditional Functions

Description

Example

COUNTIFEQ

Count If Equal to Expression

COUNTIFEQ(42, D0, 10)

COUNTIFNE

Count If Not Equal to Expression

COUNTIFNE(42, D0, 10)

COUNTIFGE

Count If Greater Than or Equal to Expression

COUNTIFGE(42, D0, 10)

COUNTIFGT

Count If Greater Than Expression

COUNTIFGT(42, D0, 10)

COUNTIFLE

Count If Less Than or Equal to Expression

COUNTIFLE(42, D0, 10)

COUNTIFLT

Count If Less Than Expression

COUNTIFLT(42, D0, 10)

IF

If / Else Expression

IF(C7, D0, D1)

SUMIFEQ

Sum if Equal to Expression

SUMIFEQ(42, D0, 10)

SUMIFNE

Sum if Not Equal to Expression

SUMIFNE(42, D0, 10)

SUMIFGE

Sum If Greater Than or Equal to Expression

SUMIFGE(42, D0, 10)

SUMIFGT

Sum if Greater Than Expression

SUMIFGT(42, D0, 10)

SUMIFLE

Sum if Less Than or Equal to Expression

SUMIFLE(42, D0, 10)

SUMIFLT

Sum if Less Than Expression

SUMIFLT(42, D0, 10)

 

Time Functions

Description

Example

NOW

Get Date/Time Stamp as a 32-bit Integer (1970 Epoch)

NOW()

TICKms

Get Millisecond System Timer Value

TICKms()

TICKus

Get Microsecond System Timer Value

TICKus()

 

 

Memory Functions

Description

Example

REF

Read Value Indirectly

REF(D0, V0)

[ ]

Array Index Expression

D[ (V10 * 16) + V11 ]

 

Download the FREE Do-more Designer Software Today!

 

Copyright © AutomationDirect.com. All rights reserved.All prices are U.S. list prices.