Math Registers in Micrologix 1100

Karac

Member
Join Date
Jan 2012
Location
South Carolina
Posts
6
I'm trying to convert a millimeter value to an inch value in a micrologix 1100, writing the program with RSLogix 500. Multiplying the millimeter by 254 and then dividing that by 10 is successfull to a point - but can be off by as much as half an inch because the division result gets rounded.

I've been fumbling around with the division command and figured out that if I set the math register S:13 as the destination, then S:13 will hold the remainder and S:14 will hold the quotient - numbers I should be able to use to get to within .01 of an inch.

The problem I'm having is I can't figure out a command to pull the numbers from the S:13 and S:14 registers into the integer data file where I can store and use it. Could anybody give me a hand?
 
I think you wrote the math backwards, though it's probably right in your program.

(millimeters * 1000)/254 = inches with 2 implied decimal places

25.4 * 1000 = 25400
divided by 254 = 100 (1.00 inches)

If you use the math registers just MOV the contents

MOV S:13 N7:5 - but do this immediately after the division. Remember that the Dest of the DIV instruction must be S:13 for the remainder stuff to happen.

Or just use floating point.
 

Similar Topics

I have an expression in a structured text routine of a Logix controller that looks more or less like the following: ResultInteger := Integer1 *...
Replies
13
Views
389
This application has a motor with encoder feedback that drives a linear actuator that moves in/out, and is at roughly 45 degs from horiz. As the...
Replies
19
Views
1,365
Hi all. First time programming a machine of this type. A center driven unwind feeding to a center driven rewind. No dancers or load cells, just...
Replies
37
Views
4,893
Hello, Been a while since I posted , Still sucking air been a interesting 3.5 years the dreaded health with old age scenario. Back at it and had a...
Replies
11
Views
2,057
Hello: Some time ago I wrote some basic code for a GuardLogix, in which I needed to add and subtract tags of LINT data type. When tried to use the...
Replies
13
Views
3,753
Back
Top Bottom