As a virtual instrument development platform, LabVIEW software has become more and more widely used in the fields of design, information transmission and reception of emerging electronic instruments due to its intuitive and simple programming method, flexible display characteristics and wide compatibility. application. For example, the serial RS232 interface can realize the interaction of information between the computer and the single-chip microcomputer. Therefore, in the field of measurement and control based on single-chip microcomputer, the utilization of virtual instrument technology has also been greatly developed, reducing the investment of traditional measurement technology in hardware equipment. . Based on the theoretical research of information transfer between VISA and MCU in LabVIEW, this paper designs the processing of receiving, saving and displaying information sent by serial port based on LabVIEW for the data information sent by serial port.
1, serial communication modelingConnect the serial port data of the computer to the receiving line of the computer and use the LabVIEW software feature to receive the data to the computer. When the serial communication line is connected, the 2 receiving line and the 3 pin sending line are connected at the intersection of the two communication ends.
Figure 1 design block diagram
Figure 1 shows the block diagram of the LabVIEW design. Set the VISA serial port related parameters to the settings of the baud rate, data bits, parity, and flow control in the VISA configuration serial port (the values ​​set in this document are 9600, 8, 0, and 1.0, respectively).
The communication setting is mainly for the preparation work before the information exchange with the single chip microcomputer: for example, when sending a character or a character string to the single chip microcomputer, the single chip obtains the corresponding code, and sends the collected data to the computer through the serial port.
The reading of information mainly refers to the post-processing of the current information returned from the serial port to the computer: In order to facilitate the user who is not familiar with the computer operation, it is convenient to use LabVIEW to read and write files, and specify the current folder in which the LabVIEW file is run. Users can directly open the "data save.txt" to query the historical time data. The display information can be displayed for the received transient information; other auxiliary functions relate to the functional requirements in a specific environment, such as alarm prompts, and the waveform fluctuation characteristics of the waveform display in a certain time or space.
2, program design block diagram 2.1, program board diagramFigure 2 The first frame program diagram
Figure 2 is the program diagram of the first frame: in the sequence structure, part of the instruction is issued to the serial port by VISA: the content of the instruction should be consistent with the one-chip computer agreement: if 0x32 is sent, the MCU sends the temperature data to the serial port. The other part is prepared to write the extraction of the prompt save time.
Figure 3 second frame program diagram
The second frame of the program block is shown in Figure 3. By processing the received data as a set of strings, the length of the string is recognized, and each element is indexed and fetched separately to form a one-dimensional array, which is then converted into a character output. When saving a file, the special application of "Create Path", combined with the application of "Open/Create/Replace File" and "Set File Location" controls, is automatically created and saved or saved in "Data Save.txt" when running the program. In the file. The resulting data is displayed in a trend graph from the moment the execution begins. The method of designing the string obtained every time in the serial port to be converted into a numerical value can be realized by using the "score/index string to numerical value conversion" control, and then these data sets are built into an array, and the waveform is displayed by the waveform diagram, and the horizontal coordinate of the waveform display is embodied. The specific time is implemented by the defined coordinate method. When the vI stops running, the data in the buffer still exists, and the appropriate customization of the abscissa time can realize the display of the trend graph for a longer period of time.
2.2, running results displayDuring the test, “0x32†is sent to obtain the relevant data of the temperature. When the temperature of the hand contact temperature sensor 18820 is changed in a short time, the trend is displayed with a trend graph: starting at 2011.9.1.1920:58:38 to 2011. The .9.1921:02:48 test data trend is shown in Figure 4. A screenshot of the corresponding saved TXT file is shown in Figure 5.
Figure 4 Test data trend chart
Figure 5 screenshot of saved TXT file
In Fig. 4, a warning occurred outside the temperature of lO·32 degrees Celsius, and the test result was completed.
This paper uses the computer's $232 serial port to realize the information transmission realized by LabVlEW software and single-chip microcomputer. The information collected by the sensor of the single-chip microcomputer is used for initial identification and processing. The result is returned to the computer through the serial port. The VISA feature of LabVIEW is used to receive the serial port signal and display the current data. Waveform trend graphs are saved for a certain period of time and saved as text files.
Rack Battery Cabinets,Hot Swap Batteries,UPS Rack Mount,Modular Battery Pack
Shenzhen Unitronic Power System Co., Ltd , https://www.unitronicpower.com