FSC / Logix 5000 help required

markymark31

Member
Join Date
Mar 2004
Location
Corby, Northants
Posts
60
Hi Guys,

Can anyone explain where I am going wrong please ?

I have a 500 element SINT array "divert1_tracking" and I want to search it for a particular value (eg. 8 in this example) then replace any 8's it finds with a 7.

See what I have done below .....

http://www.samuels-hammond.co.uk/fsc.jpg

This search should be running all the time but if I manually put an 8 anywhere in the array, it does not change.

Any advice would be appreciated.

Many thanks,

Mark.
 
I believe it will only run once after it is enabled. When it gets to the end with no more matches, it will set the .DN bit and will have to be reset again. Perhaps you should add a branch around the XIC and MOV instruction with a XIC of the .DN bit so that will also trigger the RES?
 
Once a match is found you must clear the .IN bit for the search to continue. Refer to the FSC instructions in the help file.
 
Once a match is found you must clear the .IN bit for the search to continue. Refer to the FSC instructions in the help file.

If you'd look at the attached .JPG, you'd see the RES instruction which does that. However, there's nothing to reset the .DN bit once the FSC gets through the array with no matches - hence my comment above.
 
markymark31 - Both of the previous answers are correct, and you will have to rectify your code to take both scenarios into account. Only two extra instructions are needed...

1. The FSC, once triggered, will search through the target array for the desired "expression" - in your case the value 8. It will stop execution when it finds an 8, raising both the .FD and .IN bits. You already know that the .POS contains the location at which the expression evaluated true. If you add an OTU of the FSC's .IN bit after your MOV instruction, the next time the FSC is scanned, it will resume its search to the next match and so on, until.....

2. The FSC reaches the end of the array, where it will set the .DN bit. Adding an XIO of the FSC's .DN in front of the FSC itself will make it re-trigger on the next scan.

And I've just spotted.... Your RES on the second rung is actually making this operation inefficient. Supposing you had 8's in positions 498 and 499, the FSC would search through 499 values, stop at 498, then, because you RES it, it searches through another 500 values to find the one at position 499. Replace this with OTU FSC.IN as above, and the search will resume where it stopped. Put XIO FSC.DN in front of the FSC itself and you should be good to go.

Talking about efficiency, consider doing the SIZE instruction on a separate rung, conditional on S:FS (First Scan). You cannot change the size of an array at run-time, (only offline), so it is not necessary to keep executing this.

More on efficiency - if there is no other reason for the array to be SINTs, (eg. comms to anothe machine?), then it will execute faster if you change it to DINTs, since this is a 32-bit processor. When the processor does anything with SINTs, or INTs, it converts them to DINTs, slowing things down.
 
Last edited:
Welcome to the forum gej111.
I did look at the attached .JPG. No need to get defensive.

RES also resets .POS, which starts the search over at the beginning. Clearing the IN bit continues the search. Reset after its scanned the whole array.


Edit to add: Good pointers there on efficiency from DABA on the use of DINTs -vs- SINTS or INTS. Only bother with the SINTS if the data is coming in that way from a remote device that will not support using DINTS.
 
Last edited:
Thanks Gej111, Alaric & daba for your help that is excellent.

I will change things so I only reset the .IN after the MOV, and will add the .DN so it re-triggers when the search is complete. I'll post the modified code later. I will also change the array to DINT as suggested.

JUst a final question on the SIZE instruction, do I need it at all ? Can I not just "hard code" that value into the FSC itself as it will always be 500 ?

Mark
 
I had not thought of much need for the SIZE instruction in any project, until I saw your post and realised that it makes it easy to change the size of an array, (offline, of course), and not have to worry about any File Instructions that act upon it. Getting the size, and putting it into any FALs, FSCs, etc., will ensure that program edits are not required.

That said, you WILL need to change the lengths of COPs, CPSs, FLLs etc., those are hard-coded into the instructions !

On that basis, you're right, you can hard-code it into the FSC instruction, but if you chnage the size of the array you will need to make program edits as well.
 

Similar Topics

Hi there. In RSLogix 5000 i have an array of barcodes, and used an FSC bit to find which array position an input barcode matches. However when the...
Replies
9
Views
2,803
Hello, Please Help! I have an array of 20 registers that I want to search for a value. There will be over 100 DINTS Values that come in and if the...
Replies
7
Views
1,825
Hello Please Help, I want to use a FSC instruction that will scan 20 DINT arrays. If the arrays are greater than 1000 display the value. How do I...
Replies
4
Views
1,773
I am using the same logic from Look up a barcode example. Not able to make it work on L69 32E
Replies
2
Views
1,249
I have been using the FSC instruction in a couple of application successfully. I am now trying to use it in a new application, and I feel that I...
Replies
4
Views
2,568
Back
Top Bottom