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 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 on other sites
depending on your PLC, check out the instruction SUM, very clean.

Share on other sites
Thanx to the both of you.. its perfect

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 on other sites
Many ways to skin a cat...(no cats were harmed in this 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 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 on other sites
Thanks BITS N BYTES

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 on other sites
FLOAT is 2 word do mean +D Banker

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

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 on other sites

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

Share on other sites

Posted (edited)

Here it is again.

Found original PLC file.

Hope it helps

Sum D100 thru D199.cxp

Edited by BITS N BYTES