Light Sequencing

So, here's another cat-skinner 2-instruction method.


Before anyone points out that Index will eventually reach maximum and roll-over to negative minumum, causing the controller to Fault, just want to mention that if the timebase for the lights state change is 1 second, that will occur in just over 68 years !

EDIT : just realised that CPT could have been a simple MOV

2nd EDIT : A MVM instruction would be better, then you can use the other 12 (or 28) bits on that output module for other purposes.

2020-05-20_171007.jpg
 
Last edited:
So, here's another cat-skinner 2-instruction method.


Oh man! Other A-B h/w has a MOD operator (probably an instruction too, you overweening muckety-muck)? And you can use it in an indirect address syntax?


My crappy lil' MicroLogix can't even do modulo arithmetic without a pocketful of instructions.


I feel so impoverished ;).
 
Last edited:
Before anyone points out that Index will eventually reach maximum and roll-over to negative minumum, causing the controller to Fault, just want to mention that if the timebase for the lights state change is 1 second, that will occur in just over 68 years !

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


EDIT : just realised that CPT could have been a simple MOV

2nd EDIT : A MVM instruction would be better, then you can use the other 12 (or 28) bits on that output module for other purposes.

you can also use a mask move to give a different one

Hmmm 🍻
 
Originally posted by drbitboy:

My crappy lil' MicroLogix can't even do modulo arithmetic without a pocketful of instructions.

Maybe it can...ish. I thought there was a status register that held the remainder of an integer division. Not exactly the same but...

Originally posted by drbitboy:

And you can use it in an indirect address syntax?

Now there you are stuck. As far as I know you need to get up into the Logix 5K / Studio environment to do that.

Keith
 
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.
 
Maybe it can...ish. I thought there was a status register that held the remainder of an integer division. Not exactly the same but...

Now there you are stuck. As far as I know you need to get up into the Logix 5K / Studio environment to do that.

Keith
Perhaps it's time to start playing in a superior league, 🍻
 

Similar Topics

Hi there, I'm having trouble with a task I was given on Siemens S7. I have to sequence one light with one PB. You press the button once, the...
Replies
22
Views
5,019
Hi Guys, I have a 1769-L24-QBFCB1 that has the OK light flashing on the embedded counter module. The manual states it is a resettable fault, but...
Replies
0
Views
98
Hi to all. On our Siemens PLC power supply, the battery light is showing amber. If we do not immediately change the batteries, will we lose the...
Replies
3
Views
129
Hi all, I have a question about light towers, the way I have always used them and the way I was taught is like indicator lights, i.e. Green...
Replies
8
Views
344
I call this "slightly off topic" because my model railroad layout is controlled by a PLC. Christmas themed trains running on the layout, one at a...
Replies
1
Views
281
Back
Top Bottom