Indirection allows you to dynamically change which element of an array you are referencing. You have a DINT (CountValue), which stores a number +- ~2billion
You have an array of a type, in your case, BOOL's (MyBools)(my nemesis).
Let's say that my array of BOOL's is a recipe, which represents box orientation, 1 = rotate, 0 = don't rotate. I need to rotate the first 4 boxes, the next 4 do not rotate. So my array from [0] - [7] looks like [1, 1, 1, 1, 0, 0, 0, 0]
I have a sensor that triggers a counter, counts up each time it triggers. You move the counters ACC into your DINT. So each count, your DINT will now contain the accumulated value of your counter.
Code:
XIC MyBOOLS[CountValue] OTE TurnBox
So now when the counter is 0, you will be referencing MyBOOLS[0] because your CountValue DINT = 0. When CountValue = 1 you are now referencing MyBOOLS[1] and so on.
Your controller faulted because your array is 128 (0-127). If you indirectly try to point to [128], it doesn't exist and will fault the controller. You must make sure the value in your indirect address doesn't go beyond the boundaries of your array.