Jump to content

executing average function

Recommended Posts


i'm using a negative transition to trigger the average function. I've seen that its worked at least once, but it doesn't seem to be working most of the time.

Does it need to be held high for longer? Whats the best way to trigger it.

How will i know the results are ready?

I'm assuming it might depend on the number in the array?



Link to comment
Share on other sites

Hi Jason,

Just a quick glance at your screenshot here is a great indication that you need to break up that network into smaller parts. The fact that your screen shot didn't even catch all the logic in the one single net is a red flag. Because of the way you you built your network, it is ambigous whether your function variables are loaded prior to the function being called. You don't want to have to look at the STL to have to figure out exactly how it will operate. And if whatever that wire is traveling vertically that we don't see what connects to is the code that reads the values in, this is asking for even more trouble.


Have your negative transition in its own net, process the comparator, and fire one coil.

Just below it, using a contact off your new coil, create another net that just loads the SI141 and SI142 register.

Just below that, in a network all to itself, use the same contact to load the function call into SI140.

Then, in another net all to itself, you can buffer SI143, Si144 and SI145 into MI's, or whereever else you may want them.

Keeping the networks short and direct will make both you and the PLC happier.

Good luck and let us know how you made out.


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...