A new journey with Labview - simple serial port program

Publisher:MengyunLatest update time:2015-09-18 Source: eefocusKeywords:Labview Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
       I haven't updated my blog for a long time. Recently, I have been taking students to do practical training courses at school, all based on Labview. Unfortunately, I have never used it before, so I can only start from the beginning. I have learned many kinds of programming software before, and they all started with "Hello World". This time, time is tight, so I can't start from the classic starting point, and can only start from the part needed for this practical training.
      The practical training course I taught this time was based on Labview, and the most critical part was the serial communication part. After observing for two weeks, I found that many students were not very good at it. So I tried it myself, and the basic steps are as follows:
1. Add serial port control
       Personally, I feel that the biggest feature of Labview is that all devices are modular, which means that they can be directly dragged from the panel to the program you are writing. For this serial port program, the serial port control is naturally the most important part. By right-clicking in the program flowchart and selecting Instrument I/O->Serial Port->VISA Configure Serial Port (as shown in Figure 1), you can complete the addition of the serial port configuration control. In the program of this article, the only settings required for the serial port are serial port selection and serial port baud rate settings, so this program only introduces the above two groups of serial port settings (as shown in Figure 2). It should be noted here that the baud rate of the hardware serial port I use is 115200, so this program also sets the baud rate to 115200.
 
A new journey with Labview - simple serial port program
Figure 1 Adding serial port configuration controls
A new journey with Labview - simple serial port program
Figure 2 Serial port configuration control
2. Add serial port program
        After adding the serial port control, the next step is to complete the serial port program. Since Labview is a modular programming, you only need to drag the corresponding programming language module into the program. This article uses the While loop: after completing the serial port settings, the program enters the main loop and first determines whether the serial port is open, and then continuously reads the serial port data. This is the basic idea. The program when the conditional statement is true is as follows:
A new journey with Labview - simple serial port program
Figure 3. Program when the if statement is true
      The procedure is as follows when the conditional statement is false:
A new journey with Labview - simple serial port program
Figure 4 The program when the if statement is false [page]
3. Control layout
       After completing the first two steps, the corresponding controls have appeared in the front panel. All we need to do is to organize its layout. The interface of the entire program is arranged as follows:
A new journey with Labview - simple serial port program
    Figure 5 Front panel control layout
4. Experimental results
      Through the above steps, the serial port program is basically completed. Of course, this is a simple serial port program, and the steps are still very simple. Let's take a look at the effect:
A new journey with Labview - simple serial port program
 Figure 6: Program operation status when the read switch is turned off
 
A new journey with Labview - simple serial port program
Figure 7 Program operation status when the read switch is turned on
    These are the basic procedures, I hope they can help my classmates!
 
 

Keywords:Labview Reference address:A new journey with Labview - simple serial port program

Previous article:Solutions to LabVIEW Serial Communication Problems
Next article:Labview Machine Vision from Scratch - Image Acquisition

Recommended ReadingLatest update time:2024-11-16 20:31

Digital Multimeter Automatic Calibration System
Instrument calibration is a technical means to restore and maintain equipment performance indicators and ensure accurate and reliable measurements. Therefore, it is necessary to calibrate regularly in a national authorized calibration agency. However, with the rapid development of computer technology, large-scale in
[Test Measurement]
Digital Multimeter Automatic Calibration System
Engine Management Module Test Based on Labview PXI
1. System Hardware This tester is designed for production lines and is used with different fixtures at different workstations. NI's virtual instrument technology uses mature computer technology and modular high-performance hardware to provide strong support for the implementation of our system. At the same time, NI'
[Test Measurement]
Engine Management Module Test Based on Labview PXI
Application of lock-in amplifier based on Labview
A lock-in amplifier is an amplifier that performs phase-sensitive detection of alternating signals. It uses a reference signal with the same frequency and phase relationship as the measured signal as a comparison benchmark, and only responds to the measured signal itself and those noise components that are of the same
[Test Measurement]
Application of lock-in amplifier based on Labview
Five major features and improvements of NI LabVIEW 8.5 software
Automatic creation of class data access functions Utilize object-oriented dynamic allocation of subVIs and iterative processing Mixed checkbox MathScript debugging capabilities Pointer and interoperability improvements Based on the needs of customers and users, NI LabVIEW 8.5 software introduces a number of new feat
[Test Measurement]
Five major features and improvements of NI LabVIEW 8.5 software
Reducing F-35 Fighter Jet Testing Costs and Time with LabVIEW Real-Time Module
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
[Test Measurement]
Labview Check the running time of a while loop
Add a shift register in the while loop, use the time counter as the initial value of the shift register, add a subtraction Vi in the while loop, and then add a time counter, subtract the two, and finally display the difference. Only the approximate running time can be displayed here. As shown below.
[Test Measurement]
Labview Check the running time of a while loop
Audio segment virtual signal generator and dual-channel digital oscilloscope based on LabVIEW sound card
  In the field of electronic measurement, signal generators and oscilloscopes are one of the most basic and widely used electronic measurement equipment. Their functions are to provide an electrical signal source that meets certain technical requirements for electronic measurement and to graphically display electrical
[Test Measurement]
Audio segment virtual signal generator and dual-channel digital oscilloscope based on LabVIEW sound card
Projects in LabVIEW
  We can use LabVIEW projects to manage VI programs and other non-LabVIEW files such as LabVIEW files and documents. Even other conceivable computer files can be managed through LabVIEW projects. When you save a project, LabVIEW will create a project file (with the suffix .lvproj). In addition to saving information abo
[Test Measurement]
Projects in LabVIEW
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号