Maci Posted March 31, 2011 Report Share Posted March 31, 2011 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 Quote Link to comment
ned Posted March 31, 2011 Report Share Posted March 31, 2011 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. Quote Link to comment
crossrulz Posted March 31, 2011 Report Share Posted March 31, 2011 To turn a FIFO into a LIFO, simply use the "Enqueue Element At Opposite End" instead of the "Enqueue Element". Quote Link to comment
Daklu Posted March 31, 2011 Report Share Posted March 31, 2011 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... ] Quote Link to comment
Wire Warrior Posted March 31, 2011 Report Share Posted March 31, 2011 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 Quote Link to comment
LogMAN Posted April 2, 2011 Report Share Posted April 2, 2011 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. 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 Quote Link to comment
EvaDaniel Posted May 24, 2011 Report Share Posted May 24, 2011 I Got it, thank you Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.