LabVIEW software, as a virtual instrument development platform, has been increasingly widely used in the design of emerging electronic instruments and in the fields of information transmission and reception due to its intuitive and simple programming, flexible display characteristics, and wide compatibility. For example, the serial RS232 interface can be used to realize the information interaction between the computer and the single-chip microcomputer. Therefore, in the field of measurement and control based on single-chip microcomputers, the use of virtual instrument technology has also been greatly developed, reducing the investment of traditional measurement technology in hardware equipment. Based on the theoretical research on the information transmission between LabVIEW's VISA and single-chip microcomputers, this paper designs the processing of receiving, saving and displaying the information sent by the serial port based on LabVIEW for the data information sent by the serial port.
1. Serial communication modeling
Connect the serial port data of the computer to the receiving line of the computer, and use the characteristics of LabVIEW software to receive the data to the computer. When connecting the serial communication line, cross-connect the 2-pin receiving line and the 3-pin sending line at the two communication ends.
Figure 1 Design block diagram
The LabVIEW design block diagram is shown in Figure 1. Setting the VISA serial port related parameters mainly involves the settings of the baud rate, data bits, parity, and flow control in the VISA configuration serial port (the setting values in this article are typical values 9600, 8, 0, and 1.0, respectively).
The communication settings are mainly for the preparatory work before information exchange with the microcontroller: for example, when a character or string is sent to the microcontroller, the microcontroller obtains the corresponding code and sends the collected data to the computer through the serial port.
The reading of information is mainly for the post-processing of the relevant information returned from the serial port to the computer: In order to facilitate users who are not familiar with computer operation, the convenience of LabVIEW reading and writing files is applied, and the current folder where the LabVIEW file is running is specified. Users can directly open "Data Save.txt" to query the data of historical time. The display information can be the display of the instantaneous information received; other auxiliary functions involve functional requirements in specific environments, such as alarm prompts, and waveform display of data fluctuation characteristics within a certain time or space range.
2. Programming block diagram
2.1、Program board diagram
Figure 2 Frame 1 Program Diagram
Figure 2 is the program diagram of the first frame: In the sequential structure, one part sends instructions to the serial port through VISA: the content of the instruction must be consistent with the microcontroller agreement: for example, when 0x32 is sent, the microcontroller sends the collection result of the temperature data to the serial port, and the other part prepares for the extraction of the write prompt save time.
Figure 3 Frame 2 Program Diagram
The second frame program box is shown in Figure 3. The received data is processed as a group of strings, the string length is identified, and each element is indexed and taken out for processing, forming a one-dimensional array, and then converted into character output. When saving the file, through the special application of "Create Path", combined with the application of "Open/Create/Replace File" and "Set File Location" controls, it is automatically created and saved or continued to be saved in the "Data Save.txt" file when running the program. From the moment of execution, the obtained data is displayed in a trend chart. The method of converting the string obtained each time in the serial port into a numerical value can be realized by using the "Fractional/Exponential String to Numeric Conversion" control, and then these data are formed into an array and displayed in a waveform chart. In order to reflect the specific time, the horizontal axis of the waveform display is implemented by the definition coordinate method. When vI stops running, the data in the buffer still exists. By appropriately customizing the horizontal axis time, the trend chart display of a longer time period can be realized.
2.2. Operation results display
In this test process, "0x32" is sent to obtain the temperature data. When the hand touches the temperature sensor 18820, the temperature change in a short time is displayed in a trend chart: the test data trend chart from 2011.9.19 20:58:38 to 2011.9.19 21:02:48 is shown in Figure 4. The corresponding saved TXT file screenshot is shown in Figure 5.
Figure 4 Test data trend chart
Figure 5: Screenshot of the saved TXT file
In Figure 4, a warning was set to occur when the temperature was outside 10.32 degrees Celsius, and the test results met the design expectations.
This paper uses the computer's $232 serial port to realize the information transmission between LabVlEW software and the single-chip microcomputer. The information collected by the sensor of the single-chip microcomputer is preliminarily identified and processed, and the results are returned to the computer through the serial port. The VISA characteristics of LabVIW are used to receive serial port signals, display current data, waveform trend chart within a certain period of time, and save them in the form of text files.
Previous article:Labview serial port data analysis
Next article:How to save serial port data in labview?
- Popular Resources
- Popular amplifiers
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- In what situations are non-contact temperature sensors widely used?
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- EEWORLD University Hall----Live Replay: Microchip implements secure authentication through TrustFlex secure element and Microsoft Azure
- si4010 new construction project issues
- F28335 ADC single channel single sampling code + comments
- Create a simple project for C6713
- 【RVB2601 debugging record】+ 0.96 inch TFT transplantation
- What is the difference between DSP and microcontroller?
- How do I convert X^(a^2) to (X^a)^? ? How many powers does it represent?
- CH341/CH340 Linux Driver Usage Tutorial
- ADI & Shijian New Infrastructure Series, Episode 1 - Answer questions about Industrial Ethernet and win prizes!
- Is the 6-pin 2.54mm double-row pin 3 in a row or 6 in a row?