LabVIEW Skills Series (I) - Event Structure

Publisher:konglingdeyuanLatest update time:2015-09-10 Source: eefocusKeywords:LabVIEW Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
    The event structure is the essence of the LV programming structure. It is similar to the interrupt function of a single-chip microcomputer, and its advantage is that it does not occupy CPU resources. For example, when a key is pressed, the serial port sends data, and keyboard shortcuts are set, etc., the event structure saves a lot of system resources compared to the query structure. Below I will introduce the key points of using the event structure. For the basics, please read the help yourself.

1. Regarding the timeout connection of the event structure: The event structure has an input for the timeout event. When it is not connected, it means that it will never time out. You should pay attention to this because sometimes your event will be placed in a while loop with other structures, such as the following figure:

[Repost] HOHO Zhuixue's LabVIEW Skills Series (I) - Event Structure

Our ideal situation is that other service programs run normally in a loop (the small light flashes), and when the mouse is pressed, the event structure is processed. However, if it is written like this, since the event structure never times out, the while loop will only run once, and the second loop will only start when the mouse button is pressed. The result of this program is that the small light changes once the mouse is pressed.

    There are two ways to solve this problem: one is to add a delay time to the delay input of the event structure, such as 5ms, so that the loop will run once every 5ms and will not affect the normal operation of other service programs. The other is to put other service programs in another while loop and the event structure in a separate loop. I personally recommend the second method.

 

2. Regarding the soft trigger of the event structure: There is a button on the front panel. It is very simple and commonly used to trigger after pressing it. However, sometimes it involves the issue of soft triggering, which is to use the program (rather than the controls on the front panel) to trigger an event. Let's take a look at the following example:

[Repost] HOHO Zhuixue's LabVIEW Skills Series (I) - Event Structure

The "service program" software changes the value of the "soft trigger". Our ideal goal is that each time the service program value is changed to true, the small sign light will change once. However, the actual program running result is that no matter how many times it is pressed, the small sign light does not change. This is because direct assignment can only change the value of the variable, but cannot cause the event trigger of the secondary variable.

 

The solution is: to trigger an event by software, you must right-click the variable -> Create -> Property Node -> Value (Signal) and assign a value to it, so that the event structure can be triggered. For example, the figure below.[Repost] HOHO Zhuixue's LabVIEW Skills Series (I) - Event Structure

(When setting the event structure, uncheck the lock front panel.) Program running results: When the "service program" pops up, the small light does not change, but the event will be triggered all the time. You can see it in highlight mode. If you assign F to the "soft trigger" twice in a row, the event will also be triggered. In other words, as long as the value is assigned, the event will be triggered, not when the value changes. So a conditional structure is added to the event structure. When the "service program" is pressed, the "soft trigger" is continuously assigned T, the event structure keeps running, and the small light flashes.

 

Event structure is the essence of LV

Keywords:LabVIEW Reference address:LabVIEW Skills Series (I) - Event Structure

Previous article:Labview event structure learning
Next article:Labview loop - shift register magic

Recommended ReadingLatest update time:2024-11-16 15:26

How to connect to SQL Server database from client in LabVIEW_DSN method
      Problem description: DSN, data source name, establish a data source to connect to the database.       Specific steps: For specific programming methods, refer to the UDL method. The following is the general process of establishing a data source       . Enter "Administrative Tools" in "Control Panel":    
[Test Measurement]
Three Steps to Develop Good LabVIEW Programming Habits
Part 1~ VI Place the VIs in a systematic manner. You can use folders to manage subVIs or save subVIs as LLB files. Do not save too many VIs to LLB files, because it will take more time to save VIs to LLB files later. Use Tools»Edit VI Library to set the top VI in the LLB. Usually the main program is set as the t
[Test Measurement]
Storage of test measurement data in LabVIEW (5)
           Today, let's talk about Datalog files. This file format is a bit old. Basically, this file format can be considered binary. To be precise, if you study it carefully, you can find that the internal structure of this file is quite strange. For example, if you store 3 int32 numbers in this file and open it with
[Test Measurement]
LabVIEW Programming Patterns (V) - Producer/Consumer Pattern (2)_VI Reentrancy
Before introducing the dynamic calling of VI, it is necessary to have a general understanding of the rules of LabVIEW in the process of executing VI. As we all know, LabVIEW represents independent VIs by the file name (VI Name) of the VI, not the path of the VI. Therefore, LabVIEW does not allow VIs with the same name
[Test Measurement]
LabVIEW Programming Patterns (V) - Producer/Consumer Pattern (2)_VI Reentrancy
How to Run a LabVIEW Program - Application Note
How to use Keysight PXI instruments to run LabVIEW programs (detailed steps) The PXI system provides a high-performance PC-based measurement and automated test platform. In addition to advantages in speed, scale, and scalability, PXI users can also benefit from open industry standards, which means that PXI hardware—
[Test Measurement]
How to Run a LabVIEW Program - Application Note
Reducing F-35 Joint Strike Fighter Testing Costs and Time with LabVIEW Real-Time
The Portable Digital Data Acquisition System (PDDAS) uses LabVIEW Real-Time and PXI to control the wind tunnel test and record air pressure data from 128 different channels. "The LabVIEW Real-Time Module provides the deterministic response times required to acquire air pressure data and provide feedback control sign
[Test Measurement]
Design of constant current source circuit based on LabView
  The constant current source circuit uses an operational amplifier and a triode to form a voltage-current conversion circuit. Among them, the main function of OPA211 is to achieve high-precision V/I conversion, and the main function of the triode is to achieve power amplification. As shown in Figure 2.   Figure 2 Co
[Power Management]
Design of constant current source circuit based on LabView
Bit Error Rate Testing Using R Series Intelligent Data Acquisition
Author(s): Stephen Kulakowski - Harris RF Communications Division Industry: Aerospace/Avionics, Telecommunications, RF/Communications, Government/Defense Products: Data Acquisition, Digital I/O, LabVIEW, PXI/CompactPCI, FPGA Module The Challenge: Replace traditional box-based instru
[Test Measurement]
Bit Error Rate Testing Using R Series Intelligent Data Acquisition
Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号