Design of LDT Real-time Data Acquisition System Based on USB

Laser Doppler measurement technology (LDT) has the characteristics of high precision, fast dynamic response, large measuring range, and non-contact measurement, and has become a powerful tool for gas and fluid measurement. In recent years, it has made considerable progress in the field of solids measurement and has been widely applied to the precision measurement of solid surface roughness, motion velocity field, displacement field, and vibration field. Its rapid development puts forward higher and higher requirements for signal acquisition: high dynamic range, low power consumption, portability, and real-time high-speed data transmission with the computer. In response to this requirement, a USB-based LDT real-time data acquisition system was proposed.

The USB (Universal Serial Bus) bus is a serial interface standard for PCs developed jointly by Intel, Com-paq, Microsoft, IBM, DEC, and Northern Telecom. Its hot swap, plug and play, simple connection, high bandwidth, and bus-powered advantages make it almost the current preferred communication interface for computer peripherals.

This article is based on the USB1.1 protocol specification, a total of four buses: 5V power lines, ground lines and two data lines D+, D- driven in differential form. Up to 5m of cable can be connected to the device. Up to 5 levels of topology can be connected in a daisy-chain topology via a USB hub. 127 USB devices can be connected externally. The USB bus can provide 5V, 500mA current and supports energy-saving on-hook and wake-up modes. Its specified 12 Mbps transmission rate is about 100 times faster than a standard serial port, which is about 10 times faster than a standard parallel port.

1 system hardware design

1.1 The overall structure of the hardware

The USB real-time data acquisition system hardware is shown in Figure 1-1. The analog-to-digital conversion module inside the DSP controller TMS320F240 consists of two independent sample/hold circuits and two 10-bit dual-integrator converters. The 16 analog input channels can simultaneously convert 2 signals.

1

The 16-channel analog input signal is selected by the multi-channel analog switch and the detected signal is connected to the A/D converter. The result of the A/D conversion is written into the FIFO memory through the TMS320F240.

The TMS320F240 strobes the USBN9603 through the signal line IS and accesses it as a DSP I/O port. The D+ pin of USBN9603 is externally connected with a 1.5K pull-up resistor to make it work in full speed mode. MODE1 and MODE2 of USBN9603 are all connected to the ground potential, and USBN9603 is set as the non-bus multiplexing mode. The operation sequence is to set the address line A0 high, write the address to be written and read from the data lines D0 to D7, and then set A0 low to read and write the data in D0 to D7.

The FFT analysis, wavelet analysis, etc. are performed on the result of the A/D conversion by the DSP, and data is exchanged with the host via the USB N9603 to receive control commands.

1.2USBN9603 controller

At present, there are two types of USB interface controllers on the market: One is an MCU with a USB interface, such as Cypress's CY7C6xxxx column, Intel's 930xx series, and embedded 8051 series microcontrollers. Its system structure and instruction set are all relatively familiar to facilitate hardware development and software programming, but development tools are more expensive. The other is a dedicated interface controller, such as the Lucent's USS820, National Semiconductor's USBN960x, PHILIPS's PDIUSBD11, etc., all with MCU, DSP interface, with a flexible.

The USBN9603 is a node controller that supports the USB1.1 protocol. With static mode and asynchronous wake-up function; 5V/3.3V power supply; with a bidirectional control node Endpoint0, 3 transmit endpoints, 3 receive endpoints; 8-bit parallel interface with two modes (multiplexed mode and non-multiplexed Mode); Improved DMA transfer mode; Serial Interface Engine SIE, responsible for clock recovery, EOP detection, bit stuffing, bit solution stuffing, CRC encoding and decoding, framing, deframing, packet type identification, and node status identification.

2 system software design

The USB system software design is divided into three parts: the firmware on the USB peripheral, the client driver on the host operating system, and the application. The application program communicates with the system USBDI (USB Device Interface) through the client driver program. The system generates data transmission actions. The firmware responds to various standard requirements from the system and completes the exchange of various data and event processing.

2.1 firmware design

Firmware refers to the program that is solidified into the TMS320F240. It accomplishes two tasks: controlling A/D sampling and communicating with the host through a USB controller. USB has four data transmission modes such as control, interrupt, batch, and isochronous. The control transmission is used to transmit some system control commands. Each USB device must have a control transmission channel; interrupt transmission is suitable for use by a mouse or other manually input device; isochronous transmission is suitable for occasions requiring high real-time data performance. Such as video and audio data, but the synchronization design of its equipment and process is more difficult, and it can not provide error checking mechanism; batch transmission can provide error checking mechanism, suitable for medium-speed devices that do not regularly transmit large amounts of data such as printers, modems, etc. .

The system uses two transmission methods: control transmission and bulk transmission. The control transfer is used to implement a USB bus driver (USBD module) located on the host and programmed function drivers to perform various control operations on the device; bulk transfer is used to complete the transfer of the collected data from the device to the host.

2.2 Driver Design

The USB system driver uses a hierarchical driver model: USB device driver, USB function layer. The function layer consists of a Universal Serial Bus Driver Module (USBD) and a Host Controller Driver Module (HCD). It is provided by Windows98 and is responsible for managing the communication between the USB device driver and the USB controller; loading and unloading the USB driver; establishing communication with the universal endpoint of the USB device to perform device configuration, bidirectional conversion of the data and USB protocol framework and packaging format task.

1

The USB device driver is a key to the development of USB peripherals, and its design is based on WDM (Win-dowsDriverModel, Windows driver model). At present, Win-dows98 provides a variety of USB device drivers, but not for real-time data acquisition devices, you need Win-dows98/NT/2000DDK development kit and SoftICE debugging tools. It can be implemented by 4 modules: initialization module, plug and play management module, power management module, and I/O function implementation module.

The initialization module provides a DriverEntry entry function to define all I/O Request Packet IRP (I/O RequestPacket) processing routines. The power management module is responsible for suspending and waking up the device.

When the USB device is powered on, the host will send a command to the USB controller to obtain the device description. The device descriptor is a digital sequence of fixed length of 18 bytes, reflecting the basic attributes of the USB device. When the USB controller detects this command from the USB bus, the USB controller notifies this request to the TMS320F240 in an interrupted manner. The TMS320F240 obtains various parameters by accessing the USB controller's control registers and data registers, returning to the host all descriptors contained in all the interfaces and interfaces contained in the configuration. After the host is obtained, the "handshake" between the device and the host is initially completed.

The plug and play management module enables hot plugging and dynamic configuration of USB devices. When hardware detects USB device access, Win-dows98 looks for the appropriate driver and calls its DriverEn-try routine. Plug and Play Manager invokes the AddDevice routine of the driver, telling it to add a Device; Then, the driver creates an FDO (Function Device Object) for the USB device. In this processing project, the driver receives an IRP of the IRP-MN-START-DE-VICE, including the resource information allocated by the device. At this point, the device is set up correctly and the driver begins talking to the hardware. Of course, during the operation of the device, if the status of the device changes (suspended, pulled out, etc.), the plug and play manager also issues the corresponding IRP, and the driver performs the corresponding processing.

The I/O function implementation module performs most of the work of the I/O request. When the application makes an I/O request, it calls the Win32 API function DeviceIoControl to issue a command to the device. Then, an IRP is constructed by the I/O Manager and its MajorFunction field is set to IRP-MJ-DEVICE-CONTROL. After receiving the IRP, the USB device driver constructs a corresponding USB request block according to the control code therein, and puts it in a new IRP. The IRP is passed to the USBD module. The USBD module performs the corresponding operation based on this IRP and returns the result to the USB function driver through the IRP. After receiving the IRP, the USB function driver returns the operation result to the I/O Manager through the IRP. The result is finally returned to the application by the I/O Manager. At this point, one I/O operation to the USB device is completed.

2.3 Application Design

The PC host is the center of the real-time data acquisition system. Its basic functions include opening or closing the USB device, detecting the USB device, setting up the USB data transmission pipeline, setting the A/D status and data collection port, collecting data in real time from the USB interface, and displaying data.

In addition, the data analysis function includes a digital filter module, a linearization processing module, a demodulation module, a PLL phase-locked loop frequency multiplication module, a scale conversion module, a communication module with a lower computer, a control word generation module of a lower computer, and a database. Management module and other parts.

3 Conclusion

In order to improve the design quality, the designed laser Doppler measurement real-time data acquisition system passed a series of software such as Bwqlinst and USBComp that test USB peripheral functions, completing high-precision data acquisition and high-speed data transmission. The emergence of USB presents a challenge to the traditional bus architecture. Its advantages in ease of use and scalability are unmatched by traditional buses. The newly introduced USB2.0 specification increases the bus bandwidth to 480MB/s, further extending its application range, and provides a novel, convenient, and reliable solution for the design of real-time data acquisition systems.

In order to solve problems of Chemical Dosing System in water supply plant,such as poor mixing and flocculation effect,low automation and large chemical dosage,the technical reconstruction of chemical dosing system was performed,and polymeric ferric sulfate was replaced by polymeric aluminum ferric chloride.The automation level is improved,the chemical consumption is reduced by 22%,the chemical cost of 340 000 yuan is saved annually,and the labor intensity is reduced.

Chemical Dosing System For Water Treatment

Acid Dosing Device, Chlorine Dioxide Dosing System, Flocculant Dosing System, Chemical Dosing System

Nanjing Ligong Shuifu Environmental Protection Technology Co.,Ltd. , https://www.watermanclo2.com