Domore Technical Training Instruction Set Math Instruction Set

  • Slides: 15
Download presentation
Do-more Technical Training Instruction Set (Math)

Do-more Technical Training Instruction Set (Math)

Instruction Set (Math) • DEC “Decrement” ▫ Decrements the value in location by 1

Instruction Set (Math) • DEC “Decrement” ▫ Decrements the value in location by 1 every scan as long as it has Power Flow ▫ Parameters: �Element – location to decrement ▫ NOTES: �Real numbers can also be used

Instruction Set (Math) • INC “Increment” ▫ Increments the value in location by 1

Instruction Set (Math) • INC “Increment” ▫ Increments the value in location by 1 every scan as long as it has Power Flow ▫ Parameters: �Element – location to decrement ▫ NOTES: �Real numbers can also be used

Instruction Set (Math) Extrapolate Clamp to Highest using Highest Output two Points • LERP

Instruction Set (Math) Extrapolate Clamp to Highest using Highest Output two Points • LERP “Linear Interpolation” ▫ Uses a table of 2 to 50 input / output data pairs to generate an output by interpolation & extrapolation ▫ Parameters: � Input Variable – input location � Output Variable – generated output location Individual � Output Behavior when Data Input is. Point Less Than Lowest Input Point � Clamp to Lowest Output Point Individual Data Point � Extrapolate using Lowest two Points � Output Behavior when Input in Greater Than Highest Input Point � Clamp to Highest Output Point � Extrapolate using Highest two Points ▫ Editing Buttons � Insert – inserts row before current row � Remove – deletes current row � Move Up – moves current row up � Move Down – moves current row down � Sort – orders table by increasing value of the “Input Point” column � Import – imports data pairs to fill the table from a CSV file Linear Interpolation between data points x

Instruction Set (Math) • MATH “Calculate Expression” ▫ Performs complex math in spreadsheet-formula fashion

Instruction Set (Math) • MATH “Calculate Expression” ▫ Performs complex math in spreadsheet-formula fashion ▫ 8 levels of nested parentheses ▫ Traditional math precedence: �Parentheses �Exponents (roots) �Multiplication/Division �Addition/Subtraction �“Please Excuse My Dear Aunt Sally” ▫ Uses 32 -bit math (promotion of bytes, words, dwords) ▫ Integer math unless reals are involved, then promotion to real math occurs

Instruction Set (Math) • MATH “Calculate Expression” Arithmetic Operators Description Example + Add D

Instruction Set (Math) • MATH “Calculate Expression” Arithmetic Operators Description Example + Add D 0 + D 1 Subtract D 0 – D 1 – + * / % ** - D 0 D 10 Multiply D 0 - 15 Divide D 0 D 1 * 15 7 Modulus/Remainder / D 0 15 D 1 7 D 10 22 Raise to Power % 15 D 0 D 1 7 D 10 8 Negate ** D 0 15 D 1 7 D 10 105 D 1 -15 2 7 D 10 7 151 D 0 170859376 D 10 -15 D 0 * D 1 D 0 / D 1 D 0 % D 1 D 0 ** D 1 -D 0

Instruction Set (Math) • MATH “Calculate Expression” Binary/Bit-wise Operators Description Example & Bit-wise AND

Instruction Set (Math) • MATH “Calculate Expression” Binary/Bit-wise Operators Description Example & Bit-wise AND D 0 & 0 x 7 FFF Bit-wise OR D 0 | 0 x. FFFF Bit-wise XOR D 0 ^ D 1 Bit-wise Invert ~D 0 Shift Left D 0 << 1 Shift Right D 0 >> 1 Unsigned Shift Right D 0 >>> 1 | & ^ D 0 15 | (1111) ^715(0111) (1111) ~ D 1 D 0 <<D 0 ~ (1111) D 10 715 D 1 7(0111) >> D 0 15 (0000 hex) << D 1 000 F 7 (0111) D 10 15 (1111) >>> D 10 -16 (FFFF 0 hex) D 0 15 (1111) D 10 8>> (1000) >>> D 0 15 (1111) D 1 7 D 0 15 (1111) 7 D 10 1920 (0111 D 1 1000 0000) D 1 7 D 10 0 NOTE: Bit positions NOTE: that have been vacated Bit positions that by the been shift are filled have vacated with bit by thethe shiftsign are filled with 0 (zero)

Instruction Set (Math) • MATH “Calculate Expression” Logical Operators Description Example && Logical AND

Instruction Set (Math) • MATH “Calculate Expression” Logical Operators Description Example && Logical AND X 0 && X 1 Logical OR X 0 || X 1 || ! < <= == != >= > && NOTE: Logical NOT !X 0& D 1 non-zero? Are both D 0 NOTE: Yes: D 10=1 Less Than D 0 < Is either. NOTE: D 0 or. D 1 non-zero? No: D 10=0 D 10=1 Less Than or Equal To D 0 D 1 Is D 0 Yes: = 0<=(zero)? No: D 10=0 Yes: D 10 =1 Equal To D 0 == D 1 No: D 10 (zero) Not Equal To D 0=!=0 D 1 D 0 || 15 >= D 0 D 1 ! 15 7 D 0 > 15 D 0 D 1 < 15 71 D 10 D 1 7 D 0 15 D 0<= 0 15 D 10 1 D 10 D 1 == 71 D 0 15 D 1 7 != 15 D 10 1 Greater Than or Equal To D 0 D 1 7 D 10 0 Greater Than D 0 15 D 1 7 D 10 0 D 10 1 D 0 >= D 1 D 0 > D 1

Instruction Set (Math) • MATH “Calculate Expression” Common Functions Description Example ABS Absolute Value

Instruction Set (Math) • MATH “Calculate Expression” Common Functions Description Example ABS Absolute Value ABS(D 0) MAX Maximum Between 2 Expressions MAX(D 0, D 1) MIN Minimum Between 2 Expressions MIN(D 0, D 1) MIN MAX ABS D 0 15 D 10 7 15

Instruction Set (Math) • MATH “Calculate Expression” Real Functions Description Example E Euler’s Constant

Instruction Set (Math) • MATH “Calculate Expression” Real Functions Description Example E Euler’s Constant e E() FRAC Fractional Portion of Real Number E LN Natural Log R 10 FRAC 2. 718282 LOG Log Base 10 LN R 0 1. 234567 PI R 0 LOG 1. 234567 Returns pi Π (3. 14159) R 10 0. 2345670 TOREAL ROUND PI R 10 0. 2107203 R 0 1. 234567 Round Real to Nearest Whole # TRUNC 15 D 0 ROUND SQRT Square Root R 10 0. 09151468 3. 141593 R 10 R 0 1. 234567 R 10 15. 00000 TOINT Convert to Integer R 0 SQRT 1. 234567 R 10 TOINT 1. 000000 TOREAL Convert to Real R 0 1. 234567 R 10 1. 000000 TRUNC 1. 234567 Truncate Real to Whole # R 10 R 0 1. 111111 D 10 1 FRAC(R 0) LN(R 0) LOG(R 0) PI() ROUND(R 0) SQRT(R 0) TOINT(R 0) TOREAL(D 0) TRUNC(R 0)

Instruction Set (Math) • MATH “Calculate Expression” Trig Functions Description Example Result: R 10

Instruction Set (Math) • MATH “Calculate Expression” Trig Functions Description Example Result: R 10 R 0 = 1. 234567 ACOS Arccosine in Radians ACOS(R 0) ST 132 ($Out. Of. Range) ON Valid Range: -1. 0 to +1. 0 ASIN Arcsine in Radians ASIN(R 0) ST 132 ($Out. Of. Range) ON Valid Range: -1. 0 to +1. 0 ATAN Arctangent in Radians ATAN(R 0) R 10 = 0. 8899872 COS Cosine of Radian Angle COS(R 0) R 10 = 0. 3299299 DEG Covert Radians to Degrees DEG(R 0) R 10 = 70. 73548 RAD Convert Degrees to Radians RAD(R 0) R 10 = 0. 02154726 SIN Sine of Radian Angle SIN(R 0) R 10 = 0. 9440054 TAN Tangent of Radian Angle TAN(R 0) R 10 = 2. 861231

Instruction Set (Math) • MATH “Calculate Expression” Statistical Functions RANDINT & AVGR RANDREAL are

Instruction Set (Math) • MATH “Calculate Expression” Statistical Functions RANDINT & AVGR RANDREAL are seeded from the. MAXR RANDSEED instruction MINR STDEVPR(R 0, 10) STDEVR(R 0, 10) MAXR(R 0, 10) SUMR(R 0, 10) AVGR(R 0, 10) MINR(R 0, 10) Description R 10== =0. 3094204 0. 3261577 2. 100000 1. 200000 1. 603000 16. 03000 Example Average of Range of Values AVGR(R 0, 10) Maximum Value Across Range MAXR(R 0, 10) Minimum Value Across Range MINR(R 0, 10) R 0 1. 200000 R 1 1. 300000 RANDINT Random. R 2 Integer 2. 000000 (0 – 2147483647) RANDREAL R 3 Real 2. 100000 Random (0. 0 – 1. 0) RANDREAL() STDEVPR Population. R 4 Standard 1. 270000 Deviation of Range STDEVPR(R 0, 8) STDEVR Sample Standard Deviation R 5 1. 350000 of Range STDEVR(R 0, 8) SUMR Range R 6 Sum of 1. 750000 SUMR(R 0, 10) R 7 1. 660000 R 8 1. 500000 R 9 1. 900000 RANDINT()

Instruction Set (Math) • MATH “Calculate Expression” Conditional Functions Count. If. EQ Description Count.

Instruction Set (Math) • MATH “Calculate Expression” Conditional Functions Count. If. EQ Description Count. If. EQ(1. 35, R 0, 10) Count. If. NE(1. 35, R 0, 10) Count. If. GT(1. 35, R 0, 10) Count. If. LE(1. 35, R 0, 10) Count. If. LT(1. 35, R 0, 10) Sum. If. NE(1. 35, R 0, 10) Sum. If. EQ(1. 35, R 0, 10) Sum. If. GE(1. 35, R 0, 10) Sum. If. GT(1. 35, R 0, 10) Sum. If. LE(1. 35, R 0, 10) Sum. If. LT(1. 35, R 0, 10) 1 R 10 D 10 = 14. 68000 3. 770000 5. 120000 1. 350000 12. 26000 10. 91000 =4 9 6 3 7 Count If Equal Example COUNTIFEQ(1. 35, R 0, 10) Count. If. NE R 0 Count If Not 1. 200000 Equal COUNTIFNE(1. 35, R 0, 10) Count. If. GE Count Than Or Equal R 1 If Greater 1. 300000 COUNTIFGE(1. 35, R 0, 10) Count. If. GT Count If Greater Than R 2 2. 000000 COUNTIFGT(1. 35, R 0, 10) Count. If. LE Count Or Equal R 3 If Less Than 2. 100000 COUNTIFLE(1. 35, R 0, 10) Count. If. LT IF Count If Less Than COUNTIFLT(1. 35, R 0, 10) If / Else Expression IF(C 7, D 0, D 1) Sum If Equal SUMIFEQ(1. 35, R 0, 10) R 4 SUMIFNE(1. 35, R 0, 10) Sum. If. GT 1. 350000 ON R 6 If C 7 = 1. 750000 Sum Not Equal Then. If. D 10 = D 0 R 7 1. 660000 Sum If Greater Than Or Equal Else D 10 = D 1 R 8 1. 500000 Sum If Greater Than Sum. If. LE R 9 If Less Than 1. 900000 Sum Or Equal SUMIFLE(1. 35, R 0, 10) Sum. If. LT Sum If Less Than SUMIFLT(1. 35, R 0, 10) Sum. If. EQ Sum. If. NE Sum. If. GE R 5 1. 270000 SUMIFGE(1. 35, R 0, 10) SUMIFGT(1. 35, R 0, 10)

Instruction Set (Math) • MATH “Calculate Expression” Time Functions Description Example NOW Get Date/Time

Instruction Set (Math) • MATH “Calculate Expression” Time Functions Description Example NOW Get Date/Time 32 -bit Integer (1970 Epoch) NOW() TICKms Get. D[(V 10*16)+V 11] Millisecond. NOW() System Timer Value TICKms() D 10 = 19473 TICKus System Timerof. Value Returns the number REF(p 1, p 2) similar. Get to Microsecond 1970 REFWRITE “Write Value Indirectly” V 10 seconds since 2 instruction V 11 Description 5 Memory Functions REF [] D 37 19473 Read Value Indirectly Array Index Expression REF(p 1, p 2) p 1: Memory Block Type (see in Memory Configuration) p 2: Index TICKus() Example REF(D 0, V 0) D[(V 10*16)+V 11]

Instruction Set (Math) • RANDSEED “Random Number Seed” ▫ Sets a seed value that

Instruction Set (Math) • RANDSEED “Random Number Seed” ▫ Sets a seed value that will be used by the RANDINT() “Generate Random Integer” and RANDREAL() “Generate Random Real” functions inside the MATH “Calculate Expression” instruction ▫ Parameters: �Seed – location of seed number