Why it can not work? FIFO, so tough to understand?

cmet

Member
Join Date
Jul 2006
Location
sing
Posts
18
Dear guys, the FIFO is a pain for me. I am using siemens s7 to program it. When I use FC84 ATT table to store the data, it can work properly. But when I try to read the data by using FC85 FIFO, every time I call the fuction there is one data automaticlly stored inside the ATT table and the number of entries remain unchanged. Where is the data from??? The data supposed to be stored only when I call FC84, RIGHT? I attached the file, can anyone pls help me to find where am I WRONG?

BTW, you must use "Pulse" to triger the FC 85 and FC 84, the normal contact can not work.

Thank you in advance.
 
In your code.


You have 3 'ATT' block calls, the data IN on each are MW200, MW201 and MW202. This is incorrect as S7 works in bytes, therefore MW200 = MB200 + MB201, MW201 = MB201 + MB202, etc.

This means that you have addresses crossing each other.

The above wouldn't stop the FIFO working but your data stored will be corrupt.

I cannot see any DB's, there should be a DB5 and this has to be set correct.

EDIT 1:

I also don't think you need the one shots either, I believe this works on the rising edge.

EDIT 2:

DB5.DBW0 = Length of FIFO. As your using DB5.DBW12 as an output point, then the FIFO cannot be longer than 4.

DB5.DBW2 = Number of values currently held in FIFO.

DB5.DBW4 = Data 1
DB5.DBW6 = Data 2
DB5.DBW8 = Data 3
DB5.DBW10 = Data 4


DB5.DBW12 = Data Out.

If you want more data stored you will have to change the OUT data address.

EDIT 3:

The TABLE inputs in both the 'ATT' and 'FIFO' should be in pointer format. P#DB5.DBX0.0, not DB5.DBW0.
 
Last edited:
THANKS! I have modified it but the problem is still there.

I firstly write the data to ATT table. Secondly,
when I call FC 85 to read the data, the number of entries reduced by 1 AND there is one more word updated just behind the data remained.

call FC 84 3 times and read FC 85 times. Finally, the number of entries inside ATT is zero, but there are three datas.
 
You need the DB5 (In the code you attached there is no DB)

set up as follows:

FIFO_DB.JPG



You then need the TABLE set up as a pointer. I entered P#DB5.DBX0.0, it loses the P# when shown. If DB5 has a symbol name, then the comments for DB5.DBW0 shows.

fifo_block.JPG



Note I've removed the one shots ( the example shows no one shots, I presume it will work on rising edge of EN only).

Also corrected your addressing for MW200, MW202 and MW204.
 
cmet said:
I firstly write the data to ATT table. Secondly,
when I call FC 85 to read the data, the number of entries reduced by 1 AND there is one more word updated just behind the data remained.

call FC 84 3 times and read FC 85 times. Finally, the number of entries inside ATT is zero, but there are three datas.

That maybe correct, I'm unsure if it removes the old data, the pointer DBW2 indicates what data is valid.
 
Sorry PeterW, did you actually simulate the program and it works? Please fogive me BCZ I follow you exactly and the program still can not work.

The pulse can not be removed! Once removed, the data is copying to ATT table countiously. The number of entries equal to FIFO length after one execution of FC84.
 
Sorry about the one-shot, in looking at the Siemens help on the block, they didn't include one, so assumed that one was not necessary. I was told many years ago not to make assumptions. :)

I have tested it now and it works a treat.

Started in this state. I put 5, 6 anf 7 respectively into MW200, 202 and 204.

DB5.DBW0 = 4
DB5.DBW2 = 0
DB5.DBW4 = 0
DB5.DBW6 = 0
DB5.DBW8 = 0
DB5.DBW10 = 0
DB5.DBW12 = 0

On 1st ATT

DB5.DBW0 = 4
DB5.DBW2 = 1
DB5.DBW4 = 5
DB5.DBW6 = 0
DB5.DBW8 = 0
DB5.DBW10 = 0
DB5.DBW12 = 0

On 2nd ATT

DB5.DBW0 = 4
DB5.DBW2 = 2
DB5.DBW4 = 5
DB5.DBW6 = 6
DB5.DBW8 = 0
DB5.DBW10 = 0
DB5.DBW12 = 0


On 3rd ATT

DB5.DBW0 = 4
DB5.DBW2 = 3
DB5.DBW4 = 5
DB5.DBW6 = 6
DB5.DBW8 = 7
DB5.DBW10 = 0
DB5.DBW12 = 0

On 1st FIFO

DB5.DBW0 = 4
DB5.DBW2 = 2
DB5.DBW4 = 6
DB5.DBW6 = 7
DB5.DBW8 = 7
DB5.DBW10 = 0
DB5.DBW12 = 5

On 2nd FIFO

DB5.DBW0 = 4
DB5.DBW2 = 1
DB5.DBW4 = 7
DB5.DBW6 = 7
DB5.DBW8 = 7
DB5.DBW10 = 0
DB5.DBW12 = 6

On 3rd FIFO

DB5.DBW0 = 4
DB5.DBW2 = 0
DB5.DBW4 = 7
DB5.DBW6 = 7
DB5.DBW8 = 7
DB5.DBW10 = 0
DB5.DBW12 = 7

That was the last state. The 7's were left in the FIFO, this doesn't matter as the pointer DB5.DBW2 = 0, which states there is nothing in the FIFO.

As a test I tried running the FIFO once more and got this.


DB5.DBW0 = 4
DB5.DBW2 = 0
DB5.DBW4 = 7
DB5.DBW6 = 7
DB5.DBW8 = 7
DB5.DBW10 = 0
DB5.DBW12 = 0

It actually zero's the output word. This shows that you need to use the result in DBW12 with the coil you have at ENO, if the coil is off then disregard the result.
 
Yeah, Finally can work

:D Thank you PeterW. I though you were angery with me, hehe. I was quite confused by the ATT table in the beginning. I was there thinking about the problem for two days. And now I finally know how it is working. I can use FIFO to proceed with my airport project.

Btw, curious to know any female engineer in this forum?
 
Last edited:

Similar Topics

I am not sure if this is possible but if there is a way, you guys would be the ones to know. I am currently working on a project where we are...
Replies
7
Views
226
Hello all, I'm using a 5069-L330ER in a project and I need to essentially capture some data that will be shown as a trend on a screen. The data...
Replies
9
Views
966
Hello! I have a network of conveyors bringing raw product to 4 machines. A sensor in the hopper of each machine calls for more product. I'm...
Replies
15
Views
5,886
Hello everyone, has anyone out there ever made a FIFO using an FFL and FFU instructions on a Micro800? I have tried setting it up just as I would...
Replies
9
Views
3,123
I have a bottle capper that is using an encoder and FIFO logic to track the free standing bottles passing through a bottle capper. I have checked...
Replies
31
Views
11,684
Back
Top Bottom