I dont think it will cause a fault, it will just roll over, I tried this several years back with a counter and timers and I think I also tried indexes and others, they did not fault they would just roll over
Yeah I got what I thought was a surprising result (at the "rollover" point) ...
Data[ABS(Index) MOD 12] did fault the controller, (surprising), but ....
Data[ABS(Index MOD 12)] did NOT fault the controller,
but what happens is that after the rollover to -2,147,483,648 the lights sequence runs backwards, and will continue to do so for another 68+ years! until Index passes from -1, thru 0 to +1 But that'll be in another 68+ years.
Do you think anyone will notice that it changes "direction" on time steps 1 to 5 every 68+ years ?? I doubt it, whatever the light chasing sequence was controlling would he scrap after ten years max I reckon ...
Inside the attached zip file is a .wmv showing my code working, and I reckon I know what it is !! Street Christmas light decorations ? I'm sure I've seen that pattern ....
Now, back to the discussion that was prevalent about the use of instructions like SQO, SQI, and SQC, that Bubba might not understand. I have done a tremendous amount of working my way through other peoples code over the years, trying to "get into the programmer's head" as to how it all works. I'm sure many of us have seen some "horror stories".
Believe me, I would rather try to understand a rung of code with only two instructions on it, than work my way through perhaps 10 or more rungs of code.
Even if I was unfamiliar with one of the instructions, I would take the trouble to find out what it DOES, and I don't need to know the inner workings as to HOW it does what it does. But then I would also ask myself the question "It's worked fine for the last 2, 3 or 4 years, what has stopped it working"
The important thing is an SQO, SQI, or SQC only references source or destination data files, so if an SQO or SQC does not work as intended, I'd be heading straight there to see if the data they are using looks reasonable.
To put another perspective on the matter, SQx instructions have been in A-B PLCs since the year dot, that's about 50 years ago, and if Bubba can't accept a tried and tested 50-year old instruction then to be honest there's no hope for him.
You all use Timer instructions, you may not know HOW they work "under the hood", but you know what they DO, and you quickly learnt how to USE them. So you are probably not going to write your own code to replace a TON, for instance.
I simply cannot fathom any reluctance to use a built-in instruction, that is tried, tested and proven to work, over many years, instead preferring the "roll-you-own" code that you believe Bubba would be more comfortable with.
Many people don't understand AOI's, and still prefer to build a subroutine "because you can change it if necessary". You should not be deploying AOI's until they do 100% what you want them to do, and they are 100% tested, to deliver to the design spec.
AOI's cannot be modified online, and there are loads of good reasons why they were engineered that way. Of course, if an AOI does need to be modified after deployment, then someone has either shifted the goalposts, or it was badly written and not tested thoroughly.