Micrologix math register behavior

kolyur

Lifetime Supporting Member + Moderator
Join Date
Oct 2004
Location
Wooster, Ohio
Posts
1,602
From RSLogix 500 online help for the DIV instruction:
When rung conditions are true, this output instruction divides Source A by Source B and stores the result in the destination and the math register. The value stored in the destination is rounded. The value stored in the math register consists of the unrounded quotient (placed in the most significant word) and the remainder (placed in the least significant word).
I have found this not to be the case, on both a ML1500 and 1200. If I divide two numbers and put the result in an integer register, the math register is not changed (remains zero). The only way I can affect the math register is to set the destination of the DIV to the register itself, in which case both the high and low words will then be set as they should. So it does work but not as documented. Is this a bug or am I doing something wrong?

(My goal here was to divide two numbers and get the unrounded quotient.)
 
This is what I find in my copy of the 1200/1500 manual, 1762-rm_-en-p.pdf

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.
 
not surprising I find conflicting docs. all the time as well as bad links and ..........
hum.... I should think about this before I start ranting LOL
 

Similar Topics

Hi Group, I'm the new owner of an AB MicroLogix 1400 processor and have been trying to decide the best way to de-pressurize a compressed air tank...
Replies
8
Views
1,963
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...
Replies
2
Views
2,750
I was working on a project and ran into a problem that seemed very simple at first, but became quite a challenge to implement in RSLogix 500...
Replies
16
Views
5,573
Does anybody know how the floating point math works in the ML 1200? I'm trying to divide 2 numbers, can i get a result accurate to 1 decimal...
Replies
3
Views
3,172
Hey all, first time poster here. I am wondering if anyone has tried using a Keyence SR-X300 barcode scanner to a Micrologix 1400. Keyence sent...
Replies
0
Views
32
Back
Top Bottom