From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Suggestion for a new Channel type

I like Channels. They are very useful addition to the LabVIEW toolkit. I like that there are several kinds of them supporting different behavior types. And I think I found a missing one that would be useful. This is the specification:

 

1. The writer never blocks. Data may always be written to the writer, and it is enqueued.

2. Data are never lost. Anything written remains enqueued until read.

3. The reader never blocks. If there is nothing new in the queue, the reader continually returns the last state that was read from the queue. (Or an initial default value.)

4. Multiple writers and a single reader are to be expected; if necessary, the logic of the user interface should prevent multiple writers from interleaving.


I found this protocol useful in commanding a device via the Ethernet/IP protocol. It passes commands from various subroutines to the device I/O loops in the main program, which must never block.

 

I had to build this out of a queue and a shift register. I think. If there is actually a Channel type that would have done the trick, please let me know.

 

(Attached example: click the Go button repeatedly to ssend new data. The stable value is always 27, illustrating the ability to pass a sequence of commands rapidly but then and at a stable "idle" state.)

0 Kudos
Message 1 of 2
(1,765 Views)

Many of the Channels will do this.  The simplest example is the Stream Channel.

  • The default Stream has unlimited size, so it will not block until memory is exhausted, exactly like the Queue's default behavior.
  • Data are never lost, but remain in the Channel until read.
  • By default, the reader Blocks (as does Dequeue).  However, there is a Timeout that can be changed from -1 (never Time Out) to a value of your choosing.  If it does time out, it returns the Channel's Default value.  If you want the Last Value, you can use a Shift Register to "remember" it.
  • Streams are designed for Single Reader/Single Writer.  The Messenger Channel will support Multiple Reader/Single Writer, and also has unlimited size default for Writer and a TimeOut for Reader.

Bob "Channel Enthusiast" Schor

0 Kudos
Message 2 of 2
(1,722 Views)