Search an array and output repetitive counts

A couple of options:

1. You can Increase your Array size to 51 and set element 50 to always be 0. That will allow the 49th element to be counted if true before the FSC is Done. If you add a XIO Done Bit in front of the ADD instruction it will not count the last element because Found and Done will happen on the same scan cycle. By the same token if you don't add a XIO Done Bit and the last Array element is true, the ADD will increment every scan cycle if the FSC instruction is still enabled.

2. If you don't want to increase your array size, you can one shot the FSC and add a holding circuit using XIC FSC.EN and XIO FSC.DN. This will allow you to just use the FSC.FD in the ADD Rung and count the last element if true.


Glad you got working. Good luck with your project!
 
Last edited:
Originally posted by cwal61:

If you add a XIO Done Bit in front of the ADD instruction it will not count the last element because Found and Done will happen on the same scan cycle.

That is an issue. The way I took care of that was to add an additional rung after the ADD with the .DN bit driving an OTE. I used a contact of the OTE in place of the .DN bit in the ADD rung. That delays evaluation of the .DN condition until bit 49 can be counted (if present). However, increasing your array size and scan length by 1 is a pretty easy fix too.

Keith
 
Last edited:

Similar Topics

Hi I new to ST programming and I am trying to figure out how I can search an array for an value (3). I want TEST to go high if eg trayArray[6] =...
Replies
10
Views
2,431
Hi I am stuck in trying to get my code search an array and retur an index number. So, I have an array from 0 to 254 created from an UDT where I...
Replies
7
Views
2,448
A customer is asking if I can do a check on his batch numbers and reject a batch from starting if the check fails. The setup is as follows: I have...
Replies
5
Views
1,572
when you have an array of 100 DINT's... And you enter in a wincc flex I/O field a DINT value to search for. How can you do that and know the...
Replies
3
Views
2,348
Searching edit zones within all routines and other criteria still says no results found, yet I still have the "edits present" indicator at the...
Replies
6
Views
248
Back
Top Bottom