You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old February 17th, 2017, 10:26 AM   #1
sbaum
Member
Canada

sbaum is offline
 
Join Date: Mar 2009
Location: Ontario
Posts: 88
RSLogix 500 - Find Remainder when Dividing Integers

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.
  Reply With Quote
Old February 17th, 2017, 10:32 AM   #2
jkerekes
Member
United States

jkerekes is offline
 
jkerekes's Avatar
 
Join Date: Aug 2007
Location: NJ
Posts: 2,045
http://www.plctalk.net/qanda/showthread.php?t=35587
__________________
John
  Reply With Quote
Old February 17th, 2017, 10:34 AM   #3
Mickey
Lifetime Supporting Member
United States

Mickey is online now
 
Mickey's Avatar
 
Join Date: May 2003
Location: Palmdale,Ca
Posts: 9,612
From the manual...

Quote:
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.
__________________
Mickey

If you want happiness for an hour-take a nap. If you want happiness for a day-go fishing. If you want happiness for a month-getmarried. If you want happiness for a year-inherit a fortune. If you want happiness for a lifetime-help someone else.
----- Chinese Proverb
  Reply With Quote
Old February 17th, 2017, 10:41 AM   #4
sbaum
Member
Canada

sbaum is offline
 
Join Date: Mar 2009
Location: Ontario
Posts: 88
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.
  Reply With Quote
Old February 17th, 2017, 11:55 AM   #5
Oompas
Member
Canada

Oompas is offline
 
Join Date: Feb 2017
Location: Toronto
Posts: 5
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
__________________
Electro-Mechanical Engineering Graduate
Durham College
Oshawa, Ontario
  Reply With Quote
Old February 17th, 2017, 01:10 PM   #6
RetiQlum
Member
United States

RetiQlum is offline
 
Join Date: Feb 2017
Location: Pennsylvania
Posts: 6
Use the MOD command.

It is essentially the same thing as "REMAINDER" in other systems.
  Reply With Quote
Old February 17th, 2017, 04:46 PM   #7
Paully's5.0
Lifetime Supporting Member
United States

Paully's5.0 is offline
 
Join Date: Jan 2006
Location: WI
Posts: 1,786
Quote:
Originally Posted by RetiQlum View Post
It is essentially the same thing as "REMAINDER" in other systems.
Don't believe that is available in the Micrologix.
__________________
"Comments should be like a mini-skirt... long enough to cover the essentials but short enough to keep your interest." - Uptown47
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
RSLogix 500 (v9.00) and windows 7 Enterprise Strokur LIVE PLC Questions And Answers 12 August 12th, 2015 09:02 PM
RSLogix 500 7.30.10 not showing comments online IPSI John LIVE PLC Questions And Answers 1 May 13th, 2009 11:57 AM
RSLogix 5000 V15 Features Samneggs LIVE PLC Questions And Answers 18 April 20th, 2006 05:45 PM
RSLogix 500 bug bit me today.... jstolaruk LIVE PLC Questions And Answers 1 February 3rd, 2006 01:08 AM
Programming RSLogix 500 for SLC 500 WallyPrestone LIVE PLC Questions And Answers 4 August 29th, 2005 07:30 AM


All times are GMT -5. The time now is 09:58 PM.


.