RSLogix 500 - Find Remainder when Dividing Integers

sbaum

Member
Join Date
Mar 2009
Location
Ontario
Posts
205
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 the instruction just rounds the result.
I'm not so concerned if the result gets rounded but just need to know if there was a remainder at all.

Currently my values are Integers, but could use Floating Point if necessary.

This seems like it should be simple but I can't land on a method to do this with RSLogix500.
 
From the manual...

Use the DIV instruction to divide one value by another value (Source A/Source
B) and place the result in the Destination. If the Sources are single words and the
Destination is directly addressed to S:13 (math register), then the quotient is
stored in S:14 and the remainder is stored in S:13. If long words are used, then the
results are rounded

Floating point is a lot easier, IMHO.
 
Thanks guys.

I overlooked using S:13 as the Destination of the DIV instruction. Am too used to other platforms that just toggle a status bit.

Yes Mickey, this looks cumbersome for what I need to achieve. May convert to Float.
 
Take your floating point answer, subtract the whole number (integer) multiply back up by what you divided with.

ex. 6/5 = 1.2
1.2-1=.2
.2*5=1
 

Similar Topics

Hello, Haven't been on in a while. I need to generate a bit level pdf of the I/O for RSLogix 500. I can generate a report but it just shows the...
Replies
1
Views
110
I would like to copy register N61:131 thru N61:147 into ST252:0 I keep failing What happens is I copy into ST252:0,1, 2 etc. What am i missing...
Replies
18
Views
482
I'm trying to fix a mess of code on an older machine that's running a Micrologix 1400 and an RS232 ASCII barcode scanner. The previous guy had...
Replies
3
Views
304
I'm not super familiar with the Micrologix line of processors, but I am pretty familiar with RSLogix 500. I'm trying to simply copy a string to...
Replies
4
Views
258
I have been using RSLogix 500 version 9 for a long time now. I am about to need to move to something else Rockwell related to cover the...
Replies
8
Views
907
Back
Top Bottom