Queuing in ladder logic using only the 4 basic operators

jendrus

Member
Join Date
Nov 2011
Location
Midwest
Posts
21
Anyone have an idea of how to create a FIFO que and storage network using only the folowing instructions (and,or,not,xor).

I'm working on a legacy PLC that does not have an expanded instruction set and upgrading to one is cost and time prohibitive.

For example, you have a conveyer belt with boxes marked 'a' and boxes marked 'b'; they need to be separated into two containers based on their markings. The boxes are ID'ed at point 'x' 50 feet before the separator, which takes a few seconds to to transition between the containers. The boxes arrive in no particular order.

Thanks in advance for any help
 
Not sure if it helps but its called a Genisys non vital logic emulator. See below excerpt on the programming manual.
 
Can anyone even tell me if this is possible?

Does the device support any sort of indirect addressing, pointers, array data types, etc?

If not, it MIGHT be technically possible, but you'll very likely spend more time doing it than it would cost to simply upgrade.
 
First question
what is the PLC you say "legacy PLC" but what PLC
if you are using an AB PLC2 series then they have a FIFO function built in the simplest would be to just use it.
 
Boy, when you google "programming genisys and microlok plus", you can get quite a lot of information. From 1991. From the days when this stuff was difficult (or at least difficult-er than it is now). I have seen some oddly technical systems but that one ranks right up there with the PDP-11 systems (and could actually be even more obscure).

I would think it's time for an upgrade...

A shift register could be used as a FIFO but it's unclear whether the instruction set has some form of JMP or other thing that could freeze the FIFO when you are not clocking it.
 
I dont believe it supports any of the aforementioned (arrays,pointers,indirect addressing,etc.)

Yea its old, I wish it was as simple as replacing it with an Allen Bradley but this unit talks to other units via serial links which use a specific protocol. Needless to say that an upgrade would be a big undertaking which would involve replacing many units to 'make it work', or figuring out a way to get the ALlen bradley to talk to other units.
 
Look at page 15 of this document and you'll discover what we had to deal with in the old days to create a hardware FIFO. It's easy enough to translate to programmed logic, but depending on the length it'll be a hell of a job coding. And this example is about 1 bit only. You'll need eight in parallel do do bytes, but since you're talking about boxes a and b, I'll guess one bit will do...
 
How many FIFO file locations are you talking about?

In effect you will need to be the FIFO. You will need to determine a way to keep track of the FIFO position (probably a list of bits) as well as shifting FIFO file elements on load and unload transitions.

In a nutshell, on a FIFO load, you would look to your position bit group to find the highest zero value position bit, set the FIFO bit associated with that position to the FIFO input state, then set the FIFO position bit for that location. If you attempt a load and the highest possible position bit is already set you abort the load.

To unload, you would need to set the FIFO output to the value of FIFO file bit 0 then set file bit 0 to the status of file bit 1, file bit 1 to the status of file bit 2, etc, until you reach the FIFO file bit whose location bit is set to zero. Finally you need to reset the highest non-zero FIFO position bit. If you attempt a FIFO unload and position bit 0 is NOT set, abbort the inload.

Sound like fun yet??

Keith
 
In THEORY, yes, you probably could. I assume there is some sort of memory bits you can use to store the buffer, and you can manually shift each of them each scan if you need to. I think something like the below might work.

to add a new bit to the "buffer":

Code:
 C    Add   D  
-||---||----()
          |
 D    Add |
-||---|/|-|
C->D
B->C
A->B
New->A

to remove one from the buffer, you would need to track how long the buffer is, and pull that data out. You might need, essentially, a parallel buffer that only has one bit true, to track which element of the FIFO buffer is the one to read out of. You'd need to write the read command for all the possible elements, and only one would execute, then you'd have bump the parallel buffer down one.

In practice, this would grow super tedious very quickly if you need a FIFO buffer bigger than 3 or 4 layers deep. If you are using serial communications to other systems, could you add a small modern PLC next to it that only operates the FIFO stack, and communicate with it as well?
 
Last edited:
The excerpt from the manual appears to not show the whole instruction set. If you have word variables and can access their bits and have a SHIFT RIGHT instruction you might do this:

Var FIFO WORD

On step
INPUT => FIFO.15
SHR FIFO
FIFO.n => doSomething; n depending on que length.
!doSomething => doSomethingElse

If the que is more than 16 use 2 words

FIFO.0 => FIFO2.15
SHR FIFO2

and read off FIFO2
 
Last edited:

Similar Topics

Does any one know how to realize MSMQ queuing sending/receive from PLC to PC?
Replies
0
Views
1,149
Hi Friends While I try to install PCS7 .I must Install WINCC so I should have Message Queuing but By this Alarm "The properties of this computer...
Replies
1
Views
2,299
I have been struggling to transmit multiple messages to a serial printer with S7-200. I seem to have overcome this with the attached program, but...
Replies
8
Views
2,998
Dear All I have got 3 water treatment plant (RO) and they require backwash. each RO send to my PLC one DI signal to tell me that it needs...
Replies
2
Views
1,850
What is the best way to make an online program change with structured ladder without stopping the operation of the PLC using GX Works 2?
Replies
1
Views
98
Back
Top Bottom