State retention of 2D Boolean controls

Publisher:自由探索Latest update time:2015-10-19 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
I.    Introduction

In LabVIEW programming, we often need to click certain buttons to control the corresponding output values ​​or keep the main interface on a certain interface and maintain this state. The interface maintenance is similar to the tab control commonly used in LabVIEW. The event structure and shift register are mainly used here. Below I will design such a program to explain in detail.

2.    Design content

This article is going to design a program that can output corresponding values ​​by clicking two groups of buttons on the main interface, as shown in the figure below. When you click the horizontal x, y, and z buttons above, the values ​​of x in x+y are output respectively, and the corresponding values ​​are 100, 200, and 300 respectively; when you click the four vertical buttons on the left, the values ​​of y in x+y are output, and the corresponding values ​​are 0, 5, 10, and 15 respectively. And the original values ​​and button states are kept unchanged until the next click of a button.

 

 State retention of 2D Boolean controls


3.    Software Program

After designing the front panel as shown above, we start to design the back panel program, which can be mainly divided into three parts: initialization, event response, and state maintenance.

State retention of 2D Boolean controls
 

 

1.      Initialization: We can easily see that the Boolean constant "false" and the value 0 outside the while loop shown in the figure above are used to assign initial values ​​to the attribute node signal value of the internal Boolean control and x and y in x+y respectively;

2.      Event response: When a button is pressed, the corresponding x or y value is output to x+y, and the other buttons in the group become false, and the button is true;

3.      Maintain state: When the event times out (no button is pressed within 50ms), we keep the last output value unchanged through the shift register, and the true or false state of the button remains unchanged in this way.

4.    Operation Effect

After starting, the program runs normally, proving that the program maintains the Boolean state very well.

State retention of 2D Boolean controls

State retention of 2D Boolean controls

State retention of 2D Boolean controls
 

Reference address:State retention of 2D Boolean controls

Previous article:Use of polymorphic VIs and display of multiple fonts in strings
Next article:Data Transfer Progress Subpanel

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号