Help - Search - Members - Calendar
Full Version: RSLOGIX 500
Forums.MrPLC.com > PLCs and Supporting Devices > Allen Bradley
Brad
I am using a CPW comand to move a word to another file were I need to multiply the word, (or would like to) instead of each bit in the word. can this be done?
TechJunki
You can multiply a word by using the MUL function.
TWControls
QUOTE
I need to multiply the word, (or would like to) instead of each bit in the word. can this be done?


Do you mean multipy each bit in a word or multilpy each word that you are copying by something(example need to multiply N7:0 through N7:5 by 5)
Brad
TWControls,
Yes that is what I am trying to do. If I just use the MUL it only multiplys one bit!
TWControls
QUOTE
Yes that is what I am trying to do.


Which one.

If what you stated is what you are trying to do, use techjunki's post.

If what I stated is what you want to do, how many are you trying to manipulate and do you need to do it in a single scan. The easiest solution depends on these things.
Brad
TWControls,
I am trying to do what you wrote. I have copyed a word N15:0 through N15:6 and move it to N80:0 through N80:6 I need to multiply in one scan.
TechJunki
I think you may be a little confused between a word and a bit:

A bit is addressed as N80:0/1 -- one bit (bit 1) of a 16 bit Word

The word would be N80:0 -- One 16 bit word

A group of seven words is what you are working with N80:0 to N80:6.

Are you trying to multiply all seven word together or multiply all words by a certain number??

Explain the math you want to perform??

I assume you are using a Micrologix PLC what version is it, as the instructions vary among the different series.
Brad
You are right I am confused sorry. I am trying to multiply,
N80:0 through N80:6 by 2 at one time.
using a Micrologix 1500
TechJunki
Just to clarify this is the math

N80:0 x 2 = N80:0
N80:1 x 2 = N80:1
N80:2 x 2 = N80:2
N80:3 x 2 = N80:3
N80:4 x 2 = N80:4
N80:5 x 2 = N80:5
N80:6 x 2 = N80:6

And you would like to do this with only one instruction??


TWControls
For just 7 values I would use the MUL 7 times like Techjunki said. If you have a boat load of them to do might be able to do something similiar to RsLogix 5000s FOR statement but it's a real pain in RsLogix 500.
Spedley
I don't think such an instruction exists. Your only real option (there are other more complex ones) is to have a seperate multiply for each word.
Brad
QUOTE (TechJunki @ Dec 16 2005, 12:00 PM)
Just to clarify this is the math

N80:0 x 2 = N80:0
N80:1 x 2 = N80:1
N80:2 x 2 = N80:2
N80:3 x 2 = N80:3
N80:4 x 2 = N80:4
N80:5 x 2 = N80:5
N80:6 x 2 = N80:6

And you would like to do this with only one instruction??

Yes.
TechJunki
I think the simplest way to do this would just be to branch 7 MUL in one rung and multiply them all individually.

There are other ways but they are unecessarily complicated for this.
Brad
QUOTE (TechJunki @ Dec 16 2005, 12:19 PM)
I think the simplest way to do this would just be to branch 7 MUL in one rung and multiply them all individually.

There are other ways but they are unecessarily complicated for this.

Easy is better. Thank-you all for your time and the help!
Alaric
Unfortunately, FAL (which can do math operations on multiple words in a single instruction and scan) is not available on the ML1500. TechJunk has suggested the best option for for the ML1500.


hakko808
Would a rotate instruction be helpfull here? Since multiplication by two just shifts one space left? Usually bit shifts are quicker than multiplies.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.