MDrive/MForce – Integer math only
(no decimals)
This program demonstrates how MDrive software handles math functions. Only integers are allowed and if the result of an operation produces a remainder, that remainder is ignored and no rounding is done.
VA V1=10 'declare variables VA V2=3 VA V3 PG 1 'enter program mode at address 1 LB aa 'label aa V3=V1+V2 'add V1+V2,put in V3 PR "V3= " V3 'print V3 to term H 1000 'hold execution for 1000 mSec V3=V1*V2 'multiply V1*V2,put in V3 PR "V3= " V3 'print V3 to term H 1000 'hold execution for 1000 mSec V3=V1/V2 'divide V1/V2,put in V3 PR "V3= " V3 'print V3 to term E 'end program PG 'exit program mode '***************************************************** 'typeto run program 'program action 'V3=V1+V2 produces an answer of 13 'V3=V1*V2 produces an answer of 30 'V3=V1/V2 produces an answer of 3 'try typing different values of V1 and V2 and "ex aa" 'V1=35 'V2=4 'EX aa 'results 'V3=V1+V2=39 'V3=V1*V2=140 'V3=V1/V2=8