Hide Transcript
View Transcript
The Math functionality of the DoMore is fantastic
and the best part is it’s easy. If you can create a formula in a spreadsheet
then you can use the math function in DoMore designer. To do some simple math just type MATH, place
the destination here - We’ll make that register D0, and put your math expression here. We’re going to add memory location V12 plus
V27. That’s it. So V12 plus V27 will end up in D0. Let’s try that. We’ll accept that, write It to the PLC,
and here we go. The status is on for the Dataview, so if I
put a 10 in V12 and a 20 in V 27, and I write those out to the PLC, there they are, then
D0 should get the result of those when I turn contact C0 on. And sure enough it does. You can use indexing in math expressions like
this. Let’s have D indexed by memory location
V12, and we’ll add that to D2. So what that says, is if V12 is a zero, then
this will add D0 and D2. If V12 is a 2, then it will add D2 plus D2. The index in a math function can be an expression
itself. For example, let’s index D memory based
on 7 plus the standard deviation of a range of numbers starting at R8 and going out 10
memory locations. Close that out, the dots are green, we’re
ready to go. So if this Standard deviation plus 7 comes
out to be a three, then we’re going to take the contents of D3 and place them in D2. So again, the index can be just about any
math function you can type in here. What if you can’t remember how to type the
formula like the standard deviation right here? We’ll that’s easy. You click on the question mark, it takes you
right to the Help File. If you scroll down, three’s a handy chart
right here that shows you all of the possible operators, and all of your functions. Your common functions, real functions, trig
functions, scientific functions, and conditional functions. You can count if something is not equal to
something. You can sum things, get time, and this reminds
you of the indexing functions. Note that the DoMore Designer checks your
formulas for you as you write them. For example, if I intentionally leave out
a parenthesis right here, the dot in the upper right corner turned red and then the dot on
the line where the occurred also turned red. And then when I fix that, the dot turns green
and tells me I am ready to go. You can have a Bit sized object like a contact
receive the result of a real operation. For example – if I take the square root
of D0 times D0 plus D1 times D1. So now, anytime the result of the expression
you put here is zero, the contact turns off. If the result of the expression is non-zero,
the contact turns on. Because the MATH function has all of these
Boolean operators you can use, you can actually use the math instruction to replace a rung
of ladder. So you can say if D0 is less than the contents
of D3, and the contents of V12 is less than the contents of V24, then we could turn on
Y7. So this MATH expression is identical to this
rung of ladder code. If D0 is less than D3 and V12 is less than
V24 then turn on Y7. It’s personal preference on what you prefer,
they both do the same job. We could go on and on, but you get the idea
- The beauty of the Math instruction – is it just works and itworks exactly the way
you would expect it to. And with it’s huge library of functions
and ease of use … well … it really sets the DoMore apart other PLCs. Be sure to check out the other videos in this
series for more ways to get up and running quickly with the DoMore PLC. Spend Less. Do More. From Automation Direct.