Math
Calculator
Description

Calculator

A programmable calculator with eight inputs and four outputs.

Internal calculations use the IEEE 754 binary32 (single precision) floating point data format.

The function block works as a LIFO or push-down stack machine. The program pushes input parameter values, manipulates them as needed and then pops the results to output parameters.

Click the Program parameter to view the program editor window.

The program stack list is at the left side and is executed from the top down.

There are two pages of choices for programming steps. Click a pushbutton to add that program step to the stack.

Hover the cursor over the pushbuttons in the program editor to view a brief description of the programming choice.

A single predicate flag allows for conditional execution. Find several program steps that manipulate the predicate on page two of the program editor. Any operation in the program may be made conditional. Conditional operations are not executed unless the predicate flag is true.

There are two pushbuttons at the bottom of the program stack list.

Make any program step conditional on the predicate. An asterisk next to the step's name indicates that it is conditional.
Delete any program step.

The maximum stack size is 64 entries; if this is exceeded Stack Overflow is indicated in the Calculator's Result parameter, and the function block is not executed. If there are not enough entries in the stack for an operation, a Stack Underflow results.

The inputs and outputs are standard drive.web analog parameters, 16-bit signed integers that are interpreted as percentages, 10000 = 100.00%. When pushed onto the stack, 100.00% becomes 1.0000; when popped to an output parameter, the floating point value is clamped [-3.2767, +3.2767] and then converted to a percentage.

The entire program is executed during every execution cycle of the function block engine.

Availability
  • Available only in the dw2xx & dw2xx-v2 series products
  • Requires library: Advanced Math (option -10)
  • Firmware versions 0x2016 through 0x2104
savvy-SFD Graphic calculator
Graphic with Parameters calculator

Parameters

Input 0 Input, Read-write, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Input 1 Input, Read-write, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Input 2 Input, Read-write, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Input 3 Input, Read-write, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Input 4 Input, Read-write, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Input 5 Input, Read-write, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Input 6 Input, Read-write, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Input 7 Input, Read-write, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Output 0 Output, Read-only, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Output 1 Output, Read-only, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Output 2 Output, Read-only, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Output 3 Output, Read-only, Analog (signed 16-bit integer)
-327.68 % to 327.67 %
Result Internal Parameter, Read-only, Enumerated (signed 16-bit integer)
0 = OK
1 = No Program
2 = Unknown Operation
3 = Stack Underflow
4 = Stack Overflow
Line Number Internal Parameter, Read-only, Analog (signed 16-bit integer)
0 to 2048

Length of program or line at which error occurred
Program Internal Parameter, Read-write, Calculator Program (Byte Array)