Possibly the shortest program in the world

You win hands down- it is indeed a traffic-light "program", a very simple one as you suggest, and again a classroom example.

Did you pick up on the periodic task icon, or was it a guess ?
Haha, you know, I actually did think of a traffic light demo! But, I didn't see a timer to slow down execution of the code. I assumed that making it a periodic subroutine or something might take more code (not familiar with AB stuff, or the later models, anyway), and you had mentioned that this was the only code in the processor. A chase pattern on DC outputs was the only thing I could think of that made sense that might execute at the full scan speed. Even then, it might be hard to see..
 
Haha, you know, I actually did think of a traffic light demo! But, I didn't see a timer to slow down execution of the code. I assumed that making it a periodic subroutine or something might take more code (not familiar with AB stuff, or the later models, anyway), and you had mentioned that this was the only code in the processor. A chase pattern on DC outputs was the only thing I could think of that made sense that might execute at the full scan speed. Even then, it might be hard to see..

If you are not familiar with "AB stuff", you did a good job interpreting the SQO instruction, and managed to work out it's function.

I suppose a "leading question" is why I can't reduce the program to just one instruction, i.e. why do I need the OTU of the SQO_Control.EN tag ?
 
Because it's an edge-triggered instruction, so it needs a false-to-true transition to execute each sequence step. By unlatching the EN bit, you're "tricking" the instruction into seeing each scan as a false to true transition, so it executes every scan, instead of just once on the first scan and never again.
 
Just remember I use it as a demo for a very popular "test" question for PLC programmers, as it often opens students' eyes to what is possible.

Could you expand on that? I'm curious from a teacher's perspective what this accomplishes for the students? What is it about the SQO function that seems to have so much merit in the classroom, but in my 10 years experience in the process world, it's never used. Well, I've seen it in old PLC5 programs written in the late 90's. Seemed to complicate things due to the limited number of bits it would sequence, if you had many devices you would require multiple SQO instructions to control all of them and keep them in sync.

I recall it was a good lesson in RTFM, I have to assume it helped with array handling and but other than that the SQO solution is so basic that I didn't get much out of a one line programming solution. I'm sure at the time I thought it was awesome.

Could you argue tackling the same problem with basic instruction set + indirect addressing would achieve similar lessons as the SQO solution? With the advantage providing the students something they'll actually see in the real world?

Perhaps you do this, and I just missed that experience.
 
If you are not familiar with "AB stuff", you did a good job interpreting the SQO instruction, and managed to work out it's function.

I suppose a "leading question" is why I can't reduce the program to just one instruction, i.e. why do I need the OTU of the SQO_Control.EN tag ?

Well, there is this thing called google :)

Individual instructions are easy to find references for. How a ladder program looks and behaves when it is in a periodic scan is a little different.

As ASF mentioned, the OTU is needed because the SQO instruction is edge-triggered. Nothing is in the power rail ahead of it, so something needs to turn the EN bit off.
 

Similar Topics

OK, I have a challenge for someone. I have a proface Sp-550 WA WXGA connected to a DM BOARD. Because of ,let's just say, an uncooperative company...
Replies
29
Views
5,963
Hello, I'm trying to teach myself some 'codesys' I'm not new to PLC's but I am new to codesys specifically I installed codesys V3.5 SP18 on the...
Replies
5
Views
2,854
I recently went to install a new PV at one of our machines. Backstory Old PV Part number 2711-T6C16L1 SER (B) REV (C) FRN (4.43) New PV...
Replies
28
Views
5,039
Here's my situation: I have a customer that we've been building panels for for many years. They're a molten metal furnace manufacturer. Up until...
Replies
9
Views
2,928
is it possible to convert a csv that is saved in excel to possibly a .xls or.txt file so I can read the values and insert it to a datagrid in a...
Replies
17
Views
5,945
Back
Top Bottom