“In modern industrial production, data communication is generally carried out through PCI port, ISA port or RS 232 serial interface. However, these traditional interfaces have disadvantages such as large size, poor sharing ability, and weak electromagnetic immunity. Therefore, data is easily distorted, which is different from traditional Compared with the interface, USB interface technology has become a new interface for connecting peripheral devices and computers with its plug-and-play, hot-swappable, compact interface, reliable transmission, good compatibility, shared communication, and low cost. .
Authors: Liu Caili, Zhang Weigong, Zhao Maquan
In modern industrial production, data communication is generally carried out through PCI port, ISA port or RS 232 serial interface. However, these traditional interfaces have disadvantages such as large size, poor sharing ability, and weak electromagnetic immunity. Therefore, data is easily distorted, which is different from traditional Compared with the interface, USB interface technology has become a new interface for connecting peripheral devices and computers with its plug-and-play, hot-swappable, compact interface, reliable transmission, good compatibility, shared communication, and low cost. .
Aiming at the drawbacks of the existing pile foundation test data collection methods and the need for real-time data monitoring and control, this paper designs an experimental system based on USB interface transmission. This system can realize fast data transmission between the host computer and the data collection box. The upper computer analyzes and manages the data of each channel (and controls the lower computer), and the system is safe and reliable.
1 Measurement and control system design
The system is composed of a data collection box, a host computer, a wireless transceiver module and a receiver responsible for the collection, storage, and data transmission functions. The structure is shown in Figure 1. The data acquisition box adopts the architecture of sensor front end + intelligent acquisition and control unit (stress sensor module, displacement sensor module, vibrating wire sensor module, RS 232 communication module, hydraulic control module) + main control unit, and the main control card is the data acquisition box The core is to realize the communication with the host computer and the communication with the intelligent data measurement and control unit. Various sensor signals first undergo signal conditioning and A/D conversion through the intelligent acquisition unit module, and at the same time carry out data transmission with the main control unit module through the CAN bus, which facilitates the expansion of other functions. The signal read by the main control card is sent to the receiver through the wireless transmission module, and the receiver communicates with the host computer through USB. A large-capacity NandFLASH memory is added to the main control card to realize the storage and backup of the data collected by the sensor. When the main control card and the host computer fail to transmit data wirelessly, the data in the FLASH memory can be read through the RS 232 interface reserved on the main control card, and the data in the FLASH memory can be stored for a long time after power failure, which is enhanced The reliability of the system.
Each module in the system supplies power through the backplane. In order to resist interference and eliminate the mutual influence of the power supply between the modules, each module adopts DC/DC isolation for the +5 V power supply. As the general power supply at the pile foundation construction site is not stable and the interference caused by various heavy equipment is relatively large, the intelligent acquisition units of this system are electrically isolated from each other, and the communication between the modules is carried out through the CAN bus, which enhances the safety of the system. The data acquisition box uses a 4U European standard chassis, which is composed of slots, backplanes, and power modules. Due to the low transmission distance requirements, the wireless module uses the parallel port transmission module previously produced by Remis to achieve high-speed data transmission. The receiver realizes the wireless data sending and receiving function, which is expanded from the CY7C68013 control chip of Cypress. The whole system is compact in structure, easy to build, and can meet the predetermined requirements.
2 Receiver design
The receiver is expanded from Cypress’s CY7C68013 chip. CY7C68013 includes an 8051 processor, a serial interface engine (SIE), a USB transceiver, 8.5 KB on-chip RAM, 4 KB FIFO memory and a general programmable interface (GPIF). The Intelligent Serial Interface Engine (SIE) performs all the basic USB functions and frees the embedded MCU to implement dedicated functions to ensure its continuous high-performance transmission rate.
2.1 Hardware design
CY7C68013 has three available interface modes: port, GPIF master and slave FIFO. This system adopts this GPIF main control mode. GPIF is directly connected to the FIFO as the internal main controller, and the output state of the control signal is determined by programming. For the total 8 bits of the interface data, select the FD[7:0]pin, and set WORDWIDE=0. The control output pin CTLn is used as a read and write strobe signal. The input pin RDYn is ready to be sampled by GPIF, and it can be forced to wait, continue or repeat operations, until it enters a specific state. The GPIF address line generates address accumulation along with data transmission. The chip clock is configured as an internal clock of 48 MHz, which is output through the IFCLK pin, as shown in Figure 2.
2.2 Program design
2. 2. 1 firmware design
The firmware (Firmware) communicates directly with the hardware, and its main function is to accept and process various requests from the host to the device, and return the status information of the device to the host. In order to simplify the development process of firmware code, Cypress Company specially designs a firmware program framework, the framework is shown as in Fig. 3. The main work is to complete the initialization, the processing of the USB standard device request and the USB suspend power management service. Use the framework to construct the firmware program. First, the framework initializes the internal state variables and calls the user initialization function TD_Init(). After the function returns, initialize the USB interface to the unconfigured state and enable interrupts. Perform device re-enumeration every 1s until the endpoint receives a SETUP packet. The function TD_Init() is called during the frame initialization. It is called before the device re-enumeration and task scheduling are enabled to initialize the user’s global variables.
The EZ-USB FX2 development kit provides a general-purpose driver (GPD), which can directly call the GPD function in the application to realize data exchange with the device. The functions provided in GPD can implement operations such as obtaining device information, uploading and downloading firmware, and reading and writing devices. To EZUSBSYS in GPD. C, EZUSBSYS. H, SOURCES is modified, and the driver can be generated by recompiling with the Build command in WindowsDDK and VC++6.0. Before using GPD, first include ezusbsys in the program. h header file:
The application program calls and visits EZ-USB GPD through I/O control. The program first calls the API function Createfile() to open the device and returns the device handle, and then sends a request to the device driver by calling the Win32 function DeviceIoControl() function.
The program uses the BULK method to read data to the EZ-USB device. The main list is as follows:
2.2.4 Firmware download driver
Use the unique soft configuration function of the chip to store the firmware program in the computer. When the device is connected to the USB cable, because EZ-USB has the ability to re-enumerate, after the initial enumeration, the user only needs to pass the development provided by Cypress The Download item in the software UsbContro1Panel can load the firmware into the control chip. This method is completely soft operation and does not require additional hardware equipment, which is convenient for program modification and debugging.
The wireless measurement and control system based on the USB interface is introduced. The USB interface technology has been widely used due to its plug-and-play, stable characteristics and low price. This design is the latest attempt of a pile foundation static load measurement and control system. Experiments show that the system has reasonable structure, stable performance, and reliable operation. It has achieved the predetermined effect in the application. It provides a great deal of improvement in the real-time monitoring, stability, and anti-interference of the data transmission of the pile foundation measurement and control system, and the accuracy of data transmission. Good practical value.