Research on Data Flow Control Method in LabVIEW

Publisher:MysticDreamerLatest update time:2012-03-22 Keywords:LabVIEW Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
introduction

LabVIEW (Laboratory Virtual Instrument Engineering Workbench) is the originator of the concept of virtual instrument and is the world's best virtual instrument software development platform. It uses a graphical data flow programming language. This emerging programming method has brought new difficulties to programmers, mainly reflected in the control of data flow.

This paper analyzes the characteristics of LabVIEW data flow language, provides several effective control methods, and points out that LabVIEW itself can solve the problems of variable conflict, response timing control, initial state adaptive adjustment, etc. in data flow control and ensure its universality without resorting to other code languages ​​(such as C language). In this way, the complexity of the program is reduced, the efficiency is improved, and the application of LabVIEW is enriched. This paper uses the design example of radio function buttons to elaborate on the specific solutions to the problems of variable conflict, response timing control, initial state adaptive adjustment, etc., and verifies the feasibility and effectiveness of this method in the actual operation of a certain type of equipment test system.

1 Characteristics of Data Flow Programming

Each node in the data flow language needs to provide valid data for all its input ports before execution. LabVIEW allows users to have any number of different nodes on a diagram, and all nodes can be executed in parallel. The LabVIEW environment also supports the parallel execution of multiple VIs, regardless of the operating system or computer functions. These functions allow users to execute a variety of different tasks synchronously without doing any special programming.

LabVIEW dataflow programming overcomes many of the difficulties in memory management in text language programming. In LabVIEW, you do not need to allocate memory for variables, nor do you need to assign or retrieve values ​​from variables. You only need to create a block diagram program with internal connections that describe data conversion relationships. Functions that generate data can carefully allocate memory for data, and when the data is no longer used, the corresponding memory is released. When new data is added to an array or string, sufficient memory resources to manage the new data are automatically allocated. This automatic memory allocation operation is one of the main advantages of LabVIEW.

2 Difficulties of Data Flow Programming and Some Solutions

The memory management of LabVIEW program is automatic, and it is very difficult to capture and control the intermediate state. For example, the problem of real-time display of the maximum value of the field data string, the problem of manually controlling the field data string at a certain moment as the comparison object through buttons, and the problem of implementing radio function buttons, etc., seem simple but are actually difficult. After programming practice, the summary plan is as follows:

(1) Structural control

Loop structures, such as For loop and while loop structures; Sequence structure, proper use of Sequence structure can improve program readability and make data flow clearly; Case structure; Event structure, which allows users to affect program execution through direct intervention on the front panel or communication between different parts of the program; Timed Loop structure, which can create multi-rate, time-critical data acquisition applications and define loops with different priorities.

(2) Shift Register Control

Shift registers combined with While or For loops can save various state information, and uninitialized shift registers retain their previous contents.

(3) Variable Control

Variables here refer to local variables and global variables. Local variables are used to transfer data within a VI program. They can not only solve the difficulty of wiring, but also write and read data to the same control multiple times. Global variables can be used to transfer data between different programs. Global variables also store data in the form of a control, but this control is independent of the VI that calls it and uses a special VI as its container.

(4) Notifier and Queue Control

The notification and queue methods can sometimes replace the variable method to transfer data. When using the notification method to transfer data, the data can only be read after it is written and notified. The notification is published in a broadcasting manner, and all users who receive the broadcast can read the data. When the queue method transfers data, the user who reads the data first will erase it after reading it, and there is only one user who receives the data.

Using only one of the above solutions is often not enough, and only a comprehensive and flexible use of them can produce better results in programming.

3 Example Analysis

The design of radio function buttons is part of many integrated test system designs. The functions it requires to complete are:

⑴ When a button is pressed, the remaining buttons are all in invalid working state.

⑵ The button pressed is required to correctly activate the system function.

The following issues need to be addressed in the design:

⑴ Variable conflict. The program contains mutual control between buttons, and the conflict between its controls and local variables is very prominent;

⑵ Response timing control. The order of button operation and button status reading needs to be adaptively controlled, otherwise it is easy to produce gaps (buttons are pressed but the system function is not activated) and several buttons are pressed at the same time, causing program disorder;

⑶ The problem of adaptive adjustment of initial state.

The flowchart and flowchart diagram instructions designed using LabVIEW are as follows:

BUTTON ARRAY: an array of buttons together;

SEARCH 1D ARRAY: compares the differences between two arrays and returns the serial numbers of the different elements;

INDEX ARRAY(INDEX, ELEM): array ARRAY, INDEX is the serial number, ELEM is the element. This function finds the element with the serial number INDEX in the array ARRAY;

NULL: no operation;

DIFFERENCES: difference information;

DB:Digital buttons, that is, different buttons are represented by numbers.

The overall process is to cycle the process shown in block diagram 1 twice! Then proceed with the process shown in block diagram 2. The specific steps are detailed as follows:

For problem (1), the program follows the principle of "do not operate the operated button". As shown in Figure 1, use SEARCH 1D ARRAY to identify the operated button and set "false" for other buttons. In this way, there will be no conflict between buttons.

Block Diagram 1

Block Diagram 2

Regarding question ⑵, the data "flow" operation process of the program must be fully considered. The details are as follows:

① Every time you read the BUTTON Boolean value, you must consider whether there is any operation input to the button on the external interface, which is clearly reflected in Figures 1 and 2;

② It is critical that Block 1 loops twice. Consider a situation where the button operation is between BUTTON ARRAY (1) and BUTTON ARRAY (2). In the first loop, the button operation has no effect, but it transmits the button information to the beginning through a feedback mechanism. Since the program runs much faster than the manual operation speed on the human interface, there is no external input in the second loop. In this way, the button operation is responded to after the second loop without hanging. Similarly, when the button operation is between BUTTON ARRAY (2) and read BUTTONs in Block 2, the button operation will take effect in the next loop (for the actual test system, it must be a large-scale loop operation). Since the program runs very fast, the operator sees the "real-time" operation. If it is after read BUTTONs, it returns to the beginning of Block 1. Therefore, the program runs normally at any time when the button is pressed.

For problem (3), the uninitialized shift register can retain its original state. Before the program runs, if a button abnormality occurs, the abnormal button will be corrected immediately because the program defaults to pressing a button.

For the implementation of digital buttons (see flowchart block diagram 2), the button status is converted into 0, 1, and a continuous addition operation is used to determine whether multiple buttons, a single button, or no button is pressed at the same time based on the size of the sum, thereby leading out the button signal.

Figure 2 Some LabVIEW program examples

4 Conclusion

The design of radio button is a typical example of data flow control. The method given in this paper uses LabVIEW itself to solve the problems of variable conflict, response timing control, initial state adaptive adjustment, etc., without using event-driven structure, thus avoiding the conflict caused by the parallel use of event-driven structure in the test system.

Keywords:LabVIEW Reference address:Research on Data Flow Control Method in LabVIEW

Previous article:How to choose the right oscilloscope bandwidth
Next article:Precision Adjustment of Test Indicators for Tube Amplifiers

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

Labview implements single sideband signal modulation (SSB) [filtering method]
First, a modulated signal m(t) and a carrier signal are obtained using a signal simulator. In this experiment, a sinusoidal signal is selected as the carrier signal. According to the modulator model A result signal is obtained. Among them, the choice of H(w) is a low-pass filter. The ideal low-pass filter obta
[Test Measurement]
Labview implements single sideband signal modulation (SSB) [filtering method]
What is LabVIEW?
Virtual instruments are computer-based instruments. The close integration of computers and instruments is an important direction for the current development of instruments. Roughly speaking, there are two ways to achieve this integration. One is to install a computer into an instrument, a typical example of which is th
[Test Measurement]
LabVIEW programming skills: how to sort arrays
  Labview programming skills-----How to sort arrays   Array sorting is often used, and LABVIEW provides a sorting node for one-dimensional arrays.   This is a polymorphic VI that supports multiple data types, including clusters. If it is an array of clusters, it first sorts by the first element. If the first el
[Test Measurement]
LabVIEW programming skills: how to sort arrays
Newline Issues in LabVIEW String Input Instructions
Non-IEEE488.2 standard instruments will continue to receive and store each character in the command until the required line feed character is received to indicate termination. The transmitter transmits all command characters and sets the EOI line to a high level at the end of each command. However, the receiving instru
[Test Measurement]
Newline Issues in LabVIEW String Input Instructions
LabVIEW Waveform Graph
  The waveform graph is used to display one or more curves of uniformly collected measured values. The waveform graph only draws single-value functions. After the waveform graph receives all the data to be displayed, it is displayed in the front panel window at one time. The displayed graph is a stable waveform. When
[Test Measurement]
LabVIEW Waveform Graph
LabVIEW provides six different action modes for button controls
One of the great advantages of development is that it is very convenient to make an interface. During the development process, we will definitely use front panel controls. Among the Boolean controls, there is a type of button control. We can design and implement different program functions by pressing the button. Bu
[robot]
Design of Digital Frequency Conversion FFT Based on LabVIEW
0 Introduction In the speed measurement of moving targets, the spectrum analysis method is often used to obtain the Doppler frequency of the target, and the speed measurement of the moving target is completed based on the Doppler speed measurement principle. In order to meet the requirements of high-precision speed
[Test Measurement]
Design of Digital Frequency Conversion FFT Based on LabVIEW
Latest Analog Electronics 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号