Siemens FIFO Command

M

Michael Griffin

To do a FIFO with bits (or a shift register, if you would prefer), you use
the SLW (shift left, word) or SRW (shift right, word) instructions. This shifts bits in ACCU1 (accumulator 1) left or right, respectively. You would first use a load instruction (L) to load the desired word into accumulator 1, do the shift, and then transfer (T) it back to the original location. If you need more than 16 bits, you will need a more elaborate program (let us know if this is the case).

To do one with words, you can use a series of L (load) and T (transfer) instructions. For example the following loads a series of data words (DW) and then saves them in the adjacent data word. This has the effect of moving each adjacent word over one position in
the FIFO.

L DW 9 ; Load data word 9,
T DW 10 ; Transfer it to data word 10,
L DW 8 ; Load data word 8,
T DW 9 ; Transfer it to data word 9
L DW 7
T DW 8
etc.

In either case, you need to add logic to control when these instructions are executed since they are unconditional. This is most conveniently done by encapsulating the FIFO logic in a function block and then calling the function block *once* each time you wish to shift the buffer.

I hope this answers your question, because there isn't an actual FIFO command with the S5, although you may find a general purpose function block someone else wrote. This may look a bit "low level", but it really isn't that
difficult if you are familiar with the S5. If you need more help with this, please let us know.

--

************************
Michael Griffin
London, Ont. Canada
************************
 
H

Hakan Ozevin

As far as I know, there is no FIFO command for S5 (But there is for S7). This may be the reason you couldnot find it in Siemens website.
 
D

Donald Pittendrigh

Hi All

Why did you find the Siemens web site pathetic?

I would suggest you get to the service and support section and download the appropriate manual for the PLC you are using.

However I don't think you will find any FIFO commands in the S5 instruction set
you will certainly find shift left and right commands, rotate left and right commands, index shift commands and rotate commands, ditto the above for double words.

If it is a shift register for words and not bits that you are looking for, you would have to create your own FB for this function, probably using the DO instruction to manage words in a datablock, or you could check the Siemens CA01 catalog which is viewable from the website, for standard runtime software for Simatic S5, I seem to remember there was some form of FIFO register in the standard function blocks for Simatic S5.

If none of this solves your problem, let me know specifically what you want and I will write you an FB which does the FIFO function and send you the code.

Regards
Donald Pittendrigh
 
Top