saultgeorge
Lifetime Supporting Member
Hi, folks. Thanks for taking the time to read this.
I need to average 5 numbers, they being an accumulated value (mSec) from a timer.
My director of controls and the customer don't really want me to use a compute (CPT) or the average (AVE) instructions in rs5000. So far I have tried using copies and moves to get the value in a DINT[6] array, using 1 through 5 to hold the ever changing values and then a divide (DIV) to average the results. I can't figure out how to get the total of the 5 values into position 0 in the array easily, or even how to get the 5 added up, and most importantly how to write a value to each bit in the DINT[6]. If I write to the same position in the array every time, will the existing value in there move to the next position, like a musical chairs type thing?
The time comes from a process that gets timed from when it leaves home to at home. When it sets the "at home" bit, it moves the .acc to a member in a UDT and resets the timer.
Any ideas?? Thanks, guys
I need to average 5 numbers, they being an accumulated value (mSec) from a timer.
My director of controls and the customer don't really want me to use a compute (CPT) or the average (AVE) instructions in rs5000. So far I have tried using copies and moves to get the value in a DINT[6] array, using 1 through 5 to hold the ever changing values and then a divide (DIV) to average the results. I can't figure out how to get the total of the 5 values into position 0 in the array easily, or even how to get the 5 added up, and most importantly how to write a value to each bit in the DINT[6]. If I write to the same position in the array every time, will the existing value in there move to the next position, like a musical chairs type thing?
The time comes from a process that gets timed from when it leaves home to at home. When it sets the "at home" bit, it moves the .acc to a member in a UDT and resets the timer.
Any ideas?? Thanks, guys