FIFO

8 posts in this topic

I am using the 663 FIFO instruction which is functioning properly as it loads, however when the stack is unloaded the FIFO does not set the last number to 0.  Looking at the instruction for the FIFO it seems that this is how it operates.

Is there a way to move a 0 into the stack as the values are being unloaded?

Example:

I have the following values in my stack:

217

223

224

109

When I unload the FIFO my value changes to

223

224

109

109

And if I unload again it changes to:

224

109

109

109

I want a zero till fill in the last spot as the FIFO is unloaded.

224

0

0

0

Share on other sites

The stack pointer could be used to point at the bottom of the stack to move #0000 after the FIFO.

Share on other sites
2 hours ago, Jay Anthony said:

The stack pointer could be used to point at the bottom of the stack to move #0000 after the FIFO.

I think i understand what your saying, I will try that.

Share on other sites
3 hours ago, Jay Anthony said:

The stack pointer could be used to point at the bottom of the stack to move #0000 after the FIFO.

This worked pretty well.

Thanks!

Example......I have the number 224 and I want to add to it text to say 224 Right, or say 224 with a right arrow indicator that would light up if this is the side the 224 was from.  Trick is it needs to remember when it comes time to unload from the FIFO as to whether it was Left or Right.

Share on other sites
9 minutes ago, mr_electrician said:

Example......I have the number 224 and I want to add to it text to say 224 Right, or say 224 with a right arrow indicator that would light up if this is the side the 224 was from.  Trick is it needs to remember when it comes time to unload from the FIFO as to whether it was Left or Right.

Use two parallel stacks.  Push the number onto stack A, while at the same time pushing a 0 or a 1 (or whatever numbers you want) to represent right vs left onto stack B.  Then pull them both off at the same time.

1 person likes this

Share on other sites
1 minute ago, Michael Walsh said:

Use two parallel stacks.  Push the number onto stack A, while at the same time pushing a 0 or a 1 (or whatever numbers you want) to represent right vs left onto stack B.  Then pull them both off at the same time.

Are you a mind reader????  This is what I was going to try lol!

Share on other sites

On a side note, why do you care if the data is left in the stack?  The pointers and counters will manage it all for you.   You just need to know when it is empty, right?  Or are you trying to display what is in the stack on the HMI?

Share on other sites
Just now, Michael Walsh said:

On a side note, why do you care if the data is left in the stack?  The pointers and counters will manage it all for you.   You just need to know when it is empty, right?  Or are you trying to display what is in the stack on the HMI?

Yes, the data is shown on an HMI and an operator will question it if they have no items in that location yet it shows on the HMI.