Example Code

Programmatically Trigger Value Change Events in an Event Structure in LabVIEW

产品和环境

本部分要求填写创建该范例所需的产品和操作系统。

如要下载NI软件(包括以下所示产品),请访问ni.com/downloads

    软件

  • LabVIEW

代码和文档

添加附件

Overview

This example shows how to programmatically trigger a Value Change event using Value (Signaling) control property.

 

Description

It can be very useful to force certain events to trigger programmatically at certain points in your program. In this example we want the Value Change events to be triggered at the beginning of the program. This can be useful if these events are used to set the values of indicators on the front panel.  If there is no initial update, then the indicators will be blank at first.  This example shows us how to get around that.

  

Requirements

  • LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Examine the VI block diagram: an event structure has been configured to handle Value Change events for a boolean and a numeric control. A corresponding front panel led indicator is set to on when the event is triggered
  2. Run the VI: immediately at first iteration, the two events are triggered
  3. Press Stop button to stop the VI

 

Additional Information or References

VI Block Diagram

Signaling Example LV 2012 NI Verified.png

 

VI Front Panel

SignalingExample.bmp

 

Caveats

The Value(signaling) property can't be used with latching buttons.

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

 

 

 

Jared S.
Applications Engineering
National Instruments

NI社区“代码范例交流区”(Example Code Exchange)中的代码范例已获得MIT许可

评论
altenbach
Knight of NI Knight of NI
Knight of NI
修改时间

Instead of the case structure connected to the iteration terminal, it would seem more reasonable to just place the property nodes from case "0" case before the outer loop. It is also customary to create an event for the stop button and eliminate the timeout event unless it is needed for other things.

 

Often the two triggered event should execute in a certain order. This can be achieved easily by connecting all four via the error wire in the desired order. reading the value should be done with a local variable instead of a property node.

 

triggerevents.png

 

Since the LEDs remain TRUE, running a second time does not prove anything. I would set the VI option to "clear indicators when called"