Sign in to follow this  
Followers 0
marcadams

Need help adding a range of data registers

5 posts in this topic

I'm a Q series guys when programming PLC's. I've been asked to program an A1S series to add a range of data registers together. There are 20 data registers that I need to add to one single output data register. In the Q series it's quite easy using their instructions. I cannot find the one instruction in the A-series that does what I want it to do. Is there a single instruction that does that and if so what would be an example of that? My data range starts a D3360 and goes thru D3379. I want to add all those registers together into a single "new" Data register. Thanks.

Share this post


Link to post
Share on other sites
I don't believe an A1S PLC has an instruction to do a block addition. Also keep in mind an A1S only has 1024 data register points unlike a Q-series which has 10K plus data registers points(depending on model of course). I could be wrong but I think the only option is to add each one individually. Not the greatest or cleanest way to do it, but I think that maybe your only option.

Share this post


Link to post
Share on other sites
There is no single instruction to add a contiguous list of D registers but rather than do it 'long-hand' there are methods to do this by using a nifty bit of programming and index registers. Off the top of my head and totally untested - but something like this your contiguous registers that need adding together start at 'say' d100 to d119 ADD D100V D200 D300 MOV D300 D200 INCP V You of course need to control the V register and and use a method to redo the maths each time the addition is done But, unless i have missed something, this would add as many registers together as you liked placing the total in D300

Share this post


Link to post
Share on other sites
With the help of a buddy I was able to find a way using an index register. See attached picture. The key is that your timer has to be slower than the scan time. Each time you index to a different data register it reads that data then goes on to the next at each scan. It continually adds then dumps the result into D3387 in my example. Nifty programming as mentioned abone.

Share this post


Link to post
Share on other sites
If you wanted to do the whole thing each scan, you should use a for/next loop and change the index each loop.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0