introduction
At present, the LabVIEW development platform of NI Company in the United States is widely used in the development of virtual instruments. LabVIEW software implicitly considers the various difficulties faced in designing virtual instruments and simplifies the design process. It is quite convenient for developing virtual instruments, but its hardware card is expensive, which affects the promotion and use of virtual instruments in China. Therefore, this paper proposes to use the LabVIEW virtual instrument development platform and design the hardware card by ourselves.
The design uses a single-chip microcomputer as the lower computer and uses a standard RS-232 serial port to communicate with a PC to build an acquisition control system. The upper computer sends control acquisition commands to implement channel selection, range selection, data acquisition, etc. of the acquisition control card, and then transmits the collected data to the PC through the serial port to realize data storage and analysis. In addition, the acquisition control card developed based on the serial port is also very practical because of its hot-swappable advantages.
Composition of external serial port acquisition control system
The external serial port acquisition control system is mainly composed of two parts: the lower computer hardware/software and the upper computer control software. The lower computer performs corresponding operations by receiving PC commands, such as the selection of data acquisition channels, the selection of input voltage ranges, or the selection of other quantities (such as temperature, humidity, etc.). The upper computer software mainly sends control commands, receives, displays, stores and processes data. Among them, the data transmission adopts the data frame format, and the accuracy of data transmission is guaranteed by identifying the frame header flag and other rules. This design is achieved by combining the A/D converter MAX197 provided by MAXIM.
Acquisition control card hardware design
The hardware circuit of this design uses the single-chip microcomputer 89C51 as the control core, and communicates with the PC through RS-232 to realize the data acquisition control, data processing and storage of the entire data acquisition system. The single-chip microcomputer controls MAX197 by receiving PC instructions, and the A/D acquisition is carried out in interrupt mode. The control card hardware circuit structure is shown in Figure 1.
Figure 1. Hardware structure diagram of acquisition control card
Acquisition control card software design
The MCU receives channel and range selection commands from the serial port to perform data acquisition of the corresponding channel and range, and then sends the data acquisition results to the PC in the format of a data frame. The two-byte frame header flag and the two-byte A/D conversion result are collectively called a frame of data. The MCU software design process is shown in Figure 2.
Figure 2 MCU program flow chart
Design of host computer control processing program
The host computer control processing program is developed on the LabVIEW platform. The LabVIEW program consists of two parts: the front panel and the program block diagram.
The function of LabVIEW front panel is equivalent to that of traditional instrument front panel. It can not only simulate many traditional instruments, but also simulate traditional concept instruments that cannot be realized due to complex structure. Therefore, the design has great flexibility. The front panel designed this time includes the settings of communication ports and modes, the configuration of acquisition control card, the display of current acquisition conversion results, the real-time dynamic monitoring of acquisition conversion results, and the settings of writing acquisition conversion results into Excel files.
The front panel is like the appearance design of the instrument, while the flowchart is the internal circuit of the instrument and is the core part of the design. The convenience of LabVIEW is that it can easily convert the flowchart into a graphical programming language. The loop in the flowchart can directly call the While loop in LabVIEW, the sequential execution can call the Sequence Structure in LabVIEW, and the conditional execution can call the Case Structure in LabVIEW. The program flowchart design is shown in Figure 3. LabVIEW adopts a parallel execution structure. The left and right sides above the horizontal dotted line in the main flowchart are two independent units that are executed simultaneously.
Figure 3 Program flow chart
The graphic programming of this design can be divided into three parts: serial communication, data reception and file reading and writing.
In LabVIEW, there are three ways to implement serial port communication: directly calling the Serial series subVI provided by NI; VISA serial series (located in Functions->All Functions->Instrument I/O->serial); using Active X controls to control access to the serial port (first add an Active X Container control to LabVIEW, and then add the MSComm control to it). This design uses the second method to access and control the serial port, that is, by calling the Serial series in the VISA function template (including VISA Configure Serial, VISA Write, VISA Read, VISA Close) to access and control the serial port. The advantage of using this design method is that each function starts to receive a port number and outputs a copy of the port number after the end, so there is no need to worry about forgetting or repeating operations on a port in the design, making the program design clearer.
[page]
In LabVIEW, the reading and writing of the serial port are all realized by transmitting its ASCII code in units of characters, so the data characters to be transmitted need to be converted into corresponding ASCII codes. This design embeds the C language program into the entire design by calling CIN (code interface node), and then uses mixed programming of LabVIEW and C language to realize the required functions (the calling path of CIN in LabVIEW is Functions→All Functions→Advanced→Code InteRFace Node).
In this design, the channel number and range of the acquisition control system are first sent to the lower computer, and then the program enters the corresponding data receiving processing program. In the data receiving process, the data frame method is adopted: the lower computer sends the acquisition results of the corresponding channel number and the corresponding range to the PC in a cycle in units of one frame of data, and the PC identifies the data by judging the frame header, thereby improving the accuracy of data transmission. The frame data format is as follows:
The first two bytes of data 0xAA and 0xAB are frame header marks, DATA1 and DATA0 are acquisition results, but they are not the final results, and they still need corresponding processing (this processing is performed in the service subroutine).
The collected data must be converted into actual voltage values before being displayed and stored. This design can easily store each actual voltage value in an Excel file for easy viewing and processing. In addition, during the storage process, the channel number, range, and collected data sequence number information can all be written into the file, so that it is easy to generate report output.
The program flowchart of the acquisition control system designed according to the flowchart is shown in Figure 4.
Figure 4: Block diagram of acquisition control system
System Testing
After the acquisition control system hardware and software are designed as required, run the control software, configure the acquisition control system accordingly, and then you can watch the voltage value of a certain channel in real time. Adjust the input voltage, and you can watch the change process of the input voltage through the real-time monitoring interface. After the program runs, you can find an Excel file named by the previous configuration in the program installation directory. Open this file to see all the collected data (including channel number, range, collected data and collected data sequence number information). The test shows that the acquisition control system is simple and convenient to operate, collects data accurately, is inexpensive, and has the advantage of hot plugging.
Conclusion
Because the data acquisition cards provided by NI are expensive, it is of great practical significance for users to independently develop acquisition control cards based on LabVIEW. Using the LabVIEW platform to implement it greatly simplifies the design. I hope this article can bring new design concepts to many designers.
Previous article:How to use Maxim's ambient light sensor for EOC detection
Next article:A new method for testing weft tension of loom based on virtual instrument
Recommended ReadingLatest update time:2024-11-16 22:37
- Popular Resources
- Popular amplifiers
- 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
- Modern Testing Technology and System Integration (Liu Junhua)
- Computer Control System Analysis, Design and Implementation Technology (Edited by Li Dongsheng, Zhu Wenxing, Gao Rui)
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- 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?
- 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
- What is wireless charging? What are the benefits of a wireless charging setup?
- PCB panelization skills
- A masterpiece by a senior Python programmer, helping you quickly master efficient Python programming
- MicroPython Hands-on (08) - Learn Color Recognition with MicroPython from Scratch
- Optical modules and 5G bearer networks
- Analysis of the switch input circuit composed of four diodes
- PicoVGA (2) VGA/TV driver library for Pico
- ST BlueCoin Development Kit Playing Audio
- The power consumption evaluation data of a Bluetooth headset using Qualcomm CRS8635 is shared for discussion!
- Questions about TEC control chip ADN8834