mdanielswv18 Posted January 6, 2014 Report Posted January 6, 2014 Is there a shortcut to add 5 different registries together in a Q series? Lets assume I want to add the contents of d100, d101, d102, d103, and d104 and then store them in d105. I know I could do a long process of [+ d100 d101 d200] then add everything individually and finally store my result in d104 but I would like to simplify this and I am not sure if it is possible.
Crossbow Posted January 6, 2014 Report Posted January 6, 2014 Isn't there a SUM command? Maybe WSUM or something like that? As long as they are consecutive registers there is a function for that. If using GX Works2 the math function blocks in structured ladder can be expanded to 28 inputs.
kaare_t Posted January 7, 2014 Report Posted January 7, 2014 I might be wrong here, but isn't the SUM command the same as the mathematical SUM which takes the average of x number of inputs? As mentioned, I might be wrong here, but check the docs.
gempetya Posted January 7, 2014 Report Posted January 7, 2014 (edited) If you want to add more registers, you can use the FOR - NEXT instructions. This program add the contents of all registers between D0 and D99, and store the result in D100. You can set the numbers of addition with constant after FOR instruction. Edited January 7, 2014 by gempetya
Mitsu Posted January 8, 2014 Report Posted January 8, 2014 (edited) As pointed out earlier, WSUM is ideal for this kind of thing (or if structured, increase the number of var pins) Edited January 8, 2014 by Mitsu
Crossbow Posted January 8, 2014 Report Posted January 8, 2014 kaare_t you are thinking of MEAN, not SUM. MEAN is an average function. SUM is a total.
kaare_t Posted January 8, 2014 Report Posted January 8, 2014 Yep, you are indeed correct! Good to know!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now