Jump to content

FIFO vs LIFO


Maci

Recommended Posts

Hi All, I have an application in which I am using a FIFO queue. In this application, a bar code is read from a scanner, then data acquisition is initiated. Occasionally, (more often than I want it) the scanner output is incorrect, so it must be ignored. My thought is that, if I change the FIFO to LIFO in the queue, I will always dequeue the latest value that entered the queue. Can anyone help how to use LIFO? I could not find anything in the help menu. Thanks, Mac

Link to comment

Hi All, I have an application in which I am using a FIFO queue. In this application, a bar code is read from a scanner, then data acquisition is initiated. Occasionally, (more often than I want it) the scanner output is incorrect, so it must be ignored. My thought is that, if I change the FIFO to LIFO in the queue, I will always dequeue the latest value that entered the queue. Can anyone help how to use LIFO? I could not find anything in the help menu. Thanks, Mac

If you're using standard LabVIEW queues, there's a "Enqueue Element at Opposite End" function. Using that and the standard dequeue function will act like a LIFO queue. However, I don't understand how this helps you. You'll still have the bad items in the queue and will eventually dequeue them, right? If you only want the latest data, without any past history, use a notifier instead of a queue. You could also create a functional global variable that holds the scanner output and returns it in whatever order you want.

Link to comment

In the queue palette there is an "Enqueue Element at Opposite End" primitive. This enqueues items at the front of the queue instead of the back. Using that instead of the regular enqueue prim effectively gives you a LIFO.

[Edit - Wow... we just can't wait to help someone out... :lol: ]

Link to comment

Sounds like you might be better of to have Scan Validation step which determines whether or not the scanner data is worth putting on the stack in the first place. Just guessing from your stated direction i.e. the LIFO, are you getting multiple scans returned by the scanner and only the final one in the set is good?

Jason

Link to comment

Sounds like you might be better of to have Scan Validation step which determines whether or not the scanner data is worth putting on the stack in the first place.

Double that answer!

Validate you data before putting it into the buffer!!! -> Less headache in the future, believe me. :throwpc:

Why not only putting the last scan data into the buffer, since this seems to be the one to be used?

If you can't validate which scan data is worth to be used, even an LIFO buffer will not help you, since the last element

in the buffer could also be invalid.

Note: Even if you enqueue the last element of the queue, you have to handle the remaining ones or your buffer will grow...

Greetings, LogMAN

Link to comment
  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.