Using Micrologix 1200 two INT DIV to FLOAT

edwinmart

Member
Join Date
Jun 2006
Location
Santo Domingo
Posts
31
I need to divide two INT values N7:1 and N7:2 and I am trying to store the result in F8:0 using the DIV instruction, but I am getting a error "invalid range".

+-----+
|DIV |----
|N7:1 |
|N7:2 |
|F8:0 |
+-----+

What I am trying to accomplish is the rate Good Parts / Total Parts * 100 to get the percentage.

I am also using the F8:1 for the percentage of downtime using 2 RTOs and both Float values I will show them using a PV.

But I am stuck with the DIV.

Thanks in advance.

Edwin
 
I'm not positive about this but you may need to MOV one of the N7 values into a floating point register before doing the divide. It could be choking because you're trying to divide two integers (where the result would normally be rounded) but expecting a fractional result.
 
When I tried it I didn't get any errors. Are you using a series C or later processor? Only C or later processors support floats in the ML1200.

The ML should do the type casting to match the destination address before performing the divide. You can force the type casting for the DIV as Kolyur suggested. Multiply N7:1 by 100.0 first to force the type casting by multiplying by the float constant 100.0, enter constant with included decimal) and put the destination in F8:0. Then Div F8:0 by N7:2 and put the result back in F8:0.

MUL N7:1 100.0 F8:0
DIV F8:0 N7:2 F8:0
 
Typically with A/B ladder logic math instructions, the destination typecasts the operation.

There may be exceptions with the newer Micrologix platform, but your logic should generate the results you expect from a typical RSLogix500 program.

Reading the pdf...

Hmm...

ML1200_DIV_Float2.JPG
 

Similar Topics

How do you program a Micrologic 1200 RTD module using a Micrologic 1400 PLC? I'm using RSLogix Micro to program the ladder logic. I've wired the...
Replies
4
Views
2,837
Hello All, We have a MicroLogix 1200 series controller on a package in our plant. We need to connect a serial device to MicroLogix 1200 for...
Replies
5
Views
4,622
Dear All, I have a problem that I can't communicate my MicroLogix 1200 (serial RS232) to Wonderware InTouch using ABKF2. I don't know what's...
Replies
0
Views
2,452
Hi Everyone. I have been reading through the forums, and I have learned a lot! I do have a specific question that I couldn't find. I have a...
Replies
8
Views
5,106
Need help a source code to make timer display into hour:min descending from a time of delay 1 sec base timer. Thanks
Replies
22
Views
5,916
Back
Top Bottom