LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Occurrences vs. Notifications

In looking at the help for OCCURRENCES, I notice this line:

"National Instruments encourages you to use the NOTIFIER OPERATIONS functions in place of occurrences for most operations."

The question I have is "Why?"

I know that notifications can take data, occurrences cannot. I need no data passed.

I know that notifications can have two or more receivers, occurrences only one. I only need one.

My timing shows that a SET OCCURRENCE takes 0.3 uSec, while a SEND NOTIFICATION takes 1.5 uSec.

Why do they give me such a blanket "encouragement"? Are occurrences going to be deprecated?
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 1 of 2
(3,523 Views)
CoastalMaineBird wrote:

> In looking at the help for OCCURRENCES, I notice this line:
>
> "National Instruments encourages you to use the NOTIFIER OPERATIONS
> functions in place of occurrences for most operations."
>
> The question I have is "Why?"
>
> I know that notifications can take data, occurrences cannot. I need
> no data passed.

Because they support data and have a higher level interface which is
somewhat easier to understand. Also occurrences have a little side
effect in that the occurrence can stay in a triggered state for one Wait
Occurrence evaluation when you restart a VI.

> I know that notifications can have two or more receivers, occurrences
> only one. I only need one.

You can have multiple Wait on Occurrences for one occurrence refnum
.

> My timing shows that a SET OCCURRENCE takes 0.3 uSec, while a SEND
> NOTIFICATION takes 1.5 uSec.

Which is not really a significant difference at all.

> Why do they give me such a blanket "encouragement"? Are occurrences
> going to be deprecated?

Probably not, but as I said they are not as simple to deal with. Also an
Occurrence is static meaning you can't create occurrences just like that
at runtime. Try to execute a Generate Occurrence function in a loop and
you will see that there is always the same refnum returned. This is
because the occurrence allocation is associated with the load of the VI
containing the Generate Occurrence function and not with the execution
of that icon. In fact Generate Occurrrence is a NOP during runtime.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 2
(3,523 Views)