Posted 31 Mar 2006 Hi, This is related to my previous post in scaling. Thank you guys for helping me. I have my analog values scaled and display in NS8, but it fluctuates quite rapidly. I try to use avg function, but I can't make it work. I used DM200(contains the scaled value) as S and N=#0064 and D=DM2000 I ca'nt get any value in D. I used P_on as the execution condition and also try P_1s. Can you please tell me what is wrong with my program, or any other way to average my value to lessen the fluctuation. thanks Share this post Link to post Share on other sites
Posted 31 Mar 2006 This instruction must be "pulsed" to enter the values to be averaged. The P_On contact will not allow that to happen. Try one of the pulse bits. Share this post Link to post Share on other sites
Posted 31 Mar 2006 HI, Thanks gtsupport. I tried to use 0.01seconds and 1sec , but still can't get any value in D. Does the N, no. of cycles refer to the #pulses (0.01sec) in the execution condition or it is the #cycles of the PLC? thanks Share this post Link to post Share on other sites
Posted 31 Mar 2006 It refers to the number of pulses, or number of times the instruction is executed, not the number of plc scans. Also, per the manual, the Source word must be in Hex. You may need to use the raw value instead of the scaled value for the source, then scale the result (D) word value for display. However I am not sure if this is the problem. Hope this will help. Share this post Link to post Share on other sites
Posted 31 Mar 2006 Hi, I try to use 0.1 sec pulse as the execution condition but I can't get any value on D. Attached is my program. thanks avg.cxp Share this post Link to post Share on other sites
Posted 31 Mar 2006 I tried your program (had to modify dm for CPM2A) and the average works. I used the scan time AR15 for the variable value and added a large XFER instruction to vary the scan time. You are getting a value on 234, correct. I am guessing that is the analog value of the sensor on the Inner Board. Can you see the values in DM2000 - DM2063? Processor is in Run or Monitor Mode? Not sure where else to have you check. Share this post Link to post Share on other sites
Posted 31 Mar 2006 Hi, I figured out my problem. Eventhough I mapped the AVG in expansion instruction, I did not include the expansion instructions in transferring the program to the PLC . Thanks gtsuport. It is now working. Share this post Link to post Share on other sites
Posted 31 Mar 2006 That would sure do it! Good job figuring that out. Glad it is working. Share this post Link to post Share on other sites
Posted 16 Dec 2022 14 hours ago, willer said: where is your program? Are you looking for an example of the AVG instruction use? Share this post Link to post Share on other sites
Posted 20 Dec 2022 @willer I fixed the link above and you can get his program now. Share this post Link to post Share on other sites