Ge 90-30

techno32

Member
Join Date
Nov 2012
Location
tn
Posts
2
Hey All,
It's nice to know that a place like this exists.
Just a quicky question.
I am using a GE 90-30 sampling a A/D which reads 4-15 ton load cells. I created a bank of 10 samples at 1 tenth of a sec sample rate. No problem so far. Everything is working fine except me..
I have a brain blockage or something. I need to take the 10 sample, add them up and divide by 10 to get an average.
Can someone give me a hint on a quick way without using the ADD block 9 times. sound stupid. I know there has to be a better way.:geek:
Sorry I forgot to tell you I'm using Proficy 7.0
 
There's nothing wrong with 9 individual ADDs. You could also use an ARRAY_MOVE instruction, but if you do you need to keep track of the index.

Whatever you do be sure to move the %AI value to a register and use an ADD_DINT (32 - bit) instruction. You don't want to use the %AI register in an ADD_DINT instruction because it will treat two consecutive %AI addresses as a 32- bit integer. For the same reason make sure you separate all %R addresses used in the ADD_DINT instructions by 2. For example %R101, %R103, %R105, etc.
 
"without using the ADD block 9 times"
In your code you add the Dint Register to it self 10 times (activeting
by 3S puls)and then divede the result by 10 and move it to another Gegister.

Tamir

 
Another slightly more efficient way to do this is to build an Instruction List Block and do the math in it. Call this Block as needed.
 
Back
Top Bottom