rjensen

How to add 100 words

15 posts in this topic

Hello, I am New to omron, and I can't find a function so I can add 100 words to each other.. example, D100 + D101 + D102.... +D199 Is there a function so I can do that ? thanks in advance Rasmus

Share this post


Link to post
Share on other sites

Use a FOR/NEXT routine repeated 100 times and Index Registers. Example attached will sum D100 thru D199 and place result in D0 when W0.0 is true. Sum D100 thru D199.cxp Example.pdf

1 person likes this

Share this post


Link to post
Share on other sites
depending on your PLC, check out the instruction SUM, very clean.

Share this post


Link to post
Share on other sites
Hmmm, hadn't seen that instruction. Good for single word addition but not in my opinion as flexible or easy as my original post. Especially when you need to double word addition i.e. Sum of D100+D102+D104....etc.
1 person likes this

Share this post


Link to post
Share on other sites
Many ways to skin a cat...(no cats were harmed in this post)

Share this post


Link to post
Share on other sites
Hi Can't see how to do that i'am trying to add some real arrays this way but can't get it working Banker

Share this post


Link to post
Share on other sites

See attached example for LONG WORD addition. Adds [D100,101] + [D102,103] + [D104,105}........... The key here is to double increment the index register using ,IR++. During each pass of FOR/NEXT routine [now changed to 50 times] the index pointer moves 2 words instead of one. i.e. D100 then D102 then D104. Hope this helps. SUM LONG.pdf

Share this post


Link to post
Share on other sites

You are welcome. And just for laughs here is how to add 25 words of FLOAT [4 WORD at a time]. Note that the index register is double incremented twice, once in the +F +D instruction and immediately afterwards with an output instruction. This moves the index pointer four words for each pass of the FOR/NEXT routine. First pass D100, Second pass D104 etc. etc. SUM FLOAT.pdf

1 person likes this

Share this post


Link to post
Share on other sites
OOPS. Yes it should be +D. Banker
1 person likes this

Share this post


Link to post
Share on other sites

Posted (edited)

On 28-9-2011 at 1:59 PM, BITS N BYTES said:

See attached example for LONG WORD addition. Adds [D100,101] + [D102,103] + [D104,105}........... The key here is to double increment the index register using ,IR++. During each pass of FOR/NEXT routine [now changed to 50 times] the index pointer moves 2 words instead of one. i.e. D100 then D102 then D104. Hope this helps. SUM LONG.pdf

where can I find the attachement? Also want to use this?

 

Edited by paulusB

Share this post


Link to post
Share on other sites

where can I find the attachement? Also want to use this?

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