Remainder math register does not update when using DIV instruction

LOL. Don't hold back, tell us what you REALLY think Peter!
OK
NEXT TIME BUY A CONTROLLER SUITABLE FOR THE JOB!!!!!
That is how I really feel.

There is no MOD instruction in Logix 500. This is probably because the math registers give you one directly, and I've used them for years to do just what the OP is asking about.
I know that changing how a product works can lead to all sorts of problems. Let's face it. Rockwell crippled the ML1100 so you need to buy a more expensive PLC. It is understandable except that people don't always do what was intended and the buy the cheaper product and waste much more time than they should programming around the weaknesses of the product.

I would solve the problem like this:
mod(a,b) = a-int(a/b)*b
However if I remember right Rockwell gets trick and rounds the answer to 14/5 to 3. In this case 14-(14/5)*4=-1
So if the result is negative the divisor,5, must be added back in so the result would be 4.

Some RISC controllers don't have a mod instruction either so they must do the divide, multiply and subtract trick.
 

Similar Topics

Working with a MicroLogix 1400 Ser B. I have a Divide Instuction and need to know if the result is a whole number or has a remainder. Currently...
Replies
6
Views
4,079
Im having a lot of trouble programming a Minutes and Seconds count down timer display in Productivity Software. Is there a math instruction that...
Replies
1
Views
1,966
Hello, I've got a tricky math problem. I have a double integer that I need to divide by 10,000, and separate it into quotient and remainder. I...
Replies
9
Views
7,534
does plc5 have a method for getting the remainder in a division function like in clx? thanks
Replies
15
Views
10,662
Hi, I'm pretty new to PLCs (about 2 weeks experience) and still learning all the commands but I had a problem and after spending a long time...
Replies
4
Views
3,961
Back
Top Bottom