FSC help

nsm0071

Member
Join Date
Mar 2023
Location
IL
Posts
4
Good Morning, New poster here, i'm looking to get my FSC working for some reason it is only looking at the data in the 0 dint instead of the full 22 array. Full story, I have a good product counter that I want to compare to a random list of numbers for sampling purposes. once the 2 arrays have a match i want to move a robot downstream, but i can only get it to find my first number in the array.

Thanks for any help!

FSC.png
 
Unlatch the inhibit bit (Random_list_Control.IN) to continue searching the array once a match is found not (RES). The Reset instruction in previous rung is sufficient to reset for next search after your done. The (RES) resets all control bits and position to 0. That's why you only find one match.
 
If the PLC supports the structured text language please consider the possibility of doing the search in ST. It's made to do looping in a way that is much more processor independent and is easier to understand.

I'm at the risk of incurring the wrath of the many AB fans on this website - but I don't know of any reason to use the FSC instruction and its relatives in a modern processor.
 
Thank you cwal61, I removed the extra reset bit and tried again and it still only found 25 which is in position 0 the unlatched worked to re-enable the search but still didn't find any other numbers, ive added a picture of the updated code and the array i want to look in.

thanks!

code1.PNG array.PNG
 
T, ive added a picture of the updated code and the array i want to look in.

The problem is that when it finds the first instance, your one-shot fires. When the second .FD is hit, the ONS still is fired and so will not execute the continuation logic.

Lose the ONS and it should work as you expect.
 
That FSC formula only compares the value of an element in Current_Good_Part_Array to the value of its corresponding element (i.e. at the same offset from the start) of array Random_List_1.

Is that what you want, or is there a single value you want to compare against all values in array Random_List_1?
 
The problem is that when it finds the first instance, your one-shot fires. When the second .FD is hit, the ONS still is fired and so will not execute the continuation logic.

Lose the ONS and it should work as you expect.


+1.


The flow charts for FSC start here; read and understand.
 
That FSC formula only compares the value of an element in Current_Good_Part_Array to the value of its corresponding element (i.e. at the same offset from the start) of array Random_List_1.

Is that what you want, or is there a single value you want to compare against all values in array Random_List_1?

This is not what I want, I want it to search the full 22 dint for whatever number the Current good part number is at, i had to move it to an array for the FSC unless there is another way to do that?

Thanks!
 
That FSC formula only compares the value of an element in Current_Good_Part_Array to the value of its corresponding element (i.e. at the same offset from the start) of array Random_List_1.

Is that what you want, or is there a single value you want to compare against all values in array Random_List_1?

This is not what I want, I want it to search the full 22 dint for whatever number the Current good part number is at, i had to move it to an array for the FSC unless there is another way to do that?

Thanks!

I would think that an expression like either
Random_List_1[Random_List_Control.POS]=Current_Good_Part_Array[0]
or simply
Random_List_1[Random_List_Control.POS]=Good_Part_Counter.ACC
should work. In the latter case the previous MOV would not be necessary. I would hope the data types would not need to be the same as long as both are some kind of integer, but you can find out by making the elements of the Random_List_1 array to be the same or different data type as Good_Part_Counter.ACC (i.e. DINT?).
 
Thank you cwal61, I removed the extra reset bit and tried again and it still only found 25 which is in position 0 the unlatched worked to re-enable the search but still didn't find any other numbers, ive added a picture of the updated code and the array i want to look in.

thanks!

If this is true then the FSC was done and reset. To prove this just add a counter beside the (RES) instruction and see if it increases. It's a good way to see what the logic is doing.
Also, It sounds like Part Number is overwriting Good Part Array[0] because Part_Number constantly shows 25 in all your logic pictures. (not sure on this one)

Remove the one shot as suggested by Aardwizz. It is not needed. The Unlatch of the Found bit in the same rung creates the one-shot condition.

Take another look at your expression and tell us what's the objective of the expression.

Currently you're trying to find if Random list array is equal to Current good Part array. "Random list .Position = Current Good Part .Position".

The unconditional move preceding the FSC only moves current count into Current Good Part Array [0] (not sure how it would be overwritten back to 25)

Or is the objective to find the current part count in the Random list array?

If you want to know if Current count is in the random list then change the expression to Random_List1[FSC control.Pos] = Current Good Count Array[0] as suggested by Drbitboy.
 
Last edited:

Similar Topics

RSL5K, V30, L85 Utilizing an FSC to find a value less than 1116, and greater than 1100. I canT seem to figure out how the expression is supposed...
Replies
19
Views
5,410
I've been beating my head :bonkhead: in all day trying to figure out why the FSC instruction isn't working in my Program. I Created a 1500 Recipe...
Replies
13
Views
7,017
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...
Replies
7
Views
4,555
Maybe this is just not possible, or maybe I am doing something wrong. Background; I have a data array of over 1500 products. For sorting I...
Replies
6
Views
765
I am trying to use the FSC to count how many numbers in my real array are less than a certain value but not sure why I cant for the life of me get...
Replies
11
Views
382
Back
Top Bottom