LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get # elements in RT FIFO without affecting it

My goal is to get the number of elements in an RT FIFO without changing the FIFO. I see that the RT FIFO read and RT FIFO write VIs return the number of elements in the RT FIFO, but calling these VIs will either remove or add an element from the FIFO. Does anyone know of a workaround for this? The only thing I've been able to think of is to typecast the RT FIFO Refnum to a regular Queue Refnum and use the the Get Queue Status VI to get the nubmer of elements, but this does not work. I've also tried to convert type using variants and flattened strings to no success.

0 Kudos
Message 1 of 8
(4,129 Views)
You can create a shift register with the number of elements and update it each time you read or write to the FIFO
Rodrigo Cuenca
www.cidesi.com

0 Kudos
Message 2 of 8
(4,125 Views)

I'm going to be obtaining the RT FIFO in a separate VI from where it's created and I want to monitor the number of elements in it. I would run the separate VI after the original has been running, so modifying the code of the VI that does the RT FIFO Read/Write is out of the pictutre

0 Kudos
Message 3 of 8
(4,118 Views)
If you are reading the FIFO in the RT host you can read 0 elements with 0 timeout and effectively poll the FIFO for the number elements remaining.  If you are writing to the FIFO in the RT host you can write a null valued array with 0 timeout to the FIFO and poll the empty elements remaining.
0 Kudos
Message 4 of 8
(4,105 Views)
How do i tell the RT FIFO Read VI to read 0 elements? The only inputs are the FIFO refnum, timeout, error, and element which is the deafult value to return if the FIFO is empty.
0 Kudos
Message 5 of 8
(4,092 Views)

I am showing number of elements as an input to the FPGA method as well:

fiforead.png

 

Edit:

... unless I misunderstood and this is just a FIFO that ison the RT host, and not a DMA FIFO to an FPGA.

Message Edited by WillD on 04-15-2010 11:14 AM
0 Kudos
Message 6 of 8
(4,082 Views)

I'm using the RT FIFO VIs, not the FPGA VIs.

RT FIFO.png

 

 

Message Edited by sgregor249 on 04-15-2010 11:54 AM
0 Kudos
Message 7 of 8
(4,073 Views)

There isn't the functionallity within the RT FIFO.  You can use a normal LabVIEW queue on a real-time system, it just won't guarantee determinism.  If you need to know the number of elements in an RT FIFO, you can follow this KB for more information.

 

http://digital.ni.com/public.nsf/allkb/42E85A333767918B862570D800667FD8?OpenDocument

National Instruments
Applications Engineer
0 Kudos
Message 8 of 8
(4,045 Views)