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.
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
- Popular Resources
- Popular amplifiers
- Virtualization Technology Practice Guide - High-efficiency and low-cost solutions for small and medium-sized enterprises (Wang Chunhai)
- Detailed explanation of big data technology system: principles, architecture and practice (Dong Xicheng)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
- Arduino Nano collects temperature and humidity data through LabVIEW and DHT11
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Antenna Aperture Tuning eBook
- Burn dtb file separately
- Talk about the future applications of drones and get points for speaking up
- How is the 0-10V/4-20mA input and output circuit of the inverter usually implemented?
- The editor you've been complaining about for a long time has been updated~
- MSP FRAM MCUs Reduce Volatility for the IoT
- MSP430 FAQ: Instruction System
- Repair a Bull socket
- CC1310 Two-wire Serial Bootloader Solution
- Bluetooth module problem