With the rapid development and widespread adoption of computer science and technology, data acquisition technology has permeated numerous fields such as radar, communication, underwater acoustics, remote sensing, geological exploration, vibration engineering, voice processing, intelligent instruments, industrial automatic control, and biomedical engineering. This design utilizes embedded system design technology and microprocessor technology to realize a low-power, high-capacity portable data acquisition device. The device features multi-channel data acquisition (including 8 analog acquisition channels), 16 digital acquisition channels, real-time display and storage of massive amounts of data, high integration, and portability.
Building an embedded platform
Since the 1990s, embedded real-time operating systems have established a dominant position in embedded systems. Typical products include VxWorks, PSOS, VRTX, Nucleus, Lynx, Windows CE, RTLinux, and μCOS-II. A brief introduction to the μCOS-II embedded operating system: μCOS-II features include: open source code, clear and concise code structure, detailed comments, well-organized structure, good portability, customizability, and firmware compatibility. Its kernel is preemptive and can manage up to 60 tasks. It is a proven, stable, and reliable kernel that has been successfully ported to many different processor architectures. Currently, there is significant research and application of μCOS-II in China. Introduction to the MSP430 Series Microcontrollers: The MSP430 series of microcontrollers is a new generation of 16-bit microcontrollers developed by Texas Instruments (TI) in recent years. The MSP430F169 is one such model, featuring powerful processing capabilities, a RISC architecture, a 125ns instruction cycle, rich on-chip peripherals, 2kB of internal RAM and 60kB of FLASH, and a 64k address space. The embedded processor used in this design is the TI MSP430F169; the operating system is μCOS-II. Porting μCOS-II to the MSP430F169 refers to enabling an operating system to run on a specific microprocessor or microcontroller. Although most of the μCOS-II source code is written in C, assembly language is still required for processor-related code. For μCOS-II to be successfully ported to a processor, the processor must meet the following requirements: ① The processor's C compiler can generate reentrant code; ② Interrupts can be enabled or disabled using C language; ③ The processor supports interrupts and can generate timer interrupts; ④ The processor can support a certain number of data storage hardware stacks; ⑤ The processor has instructions to store and read the stack pointer and other CPU registers onto and off the stack (or into memory).
Hardware Design
The hardware design of this data acquisition device is mainly divided into three modules: the main control unit, the data acquisition unit, and the real-time clock. The main control unit primarily designed the human-machine interface and storage circuitry. The storage circuit uses a USB interface circuit for data storage, ensuring timely and reliable storage and protection of the acquired data. The data acquisition unit mainly designs analog and digital input channels. The system's real-time clock is implemented using an MSP430F1222, which offers scalability compared to dedicated RTC devices. Core circuit design...
The microprocessor is the core component of the entire circuit, and its performance directly affects and determines the system's functional specifications. The crystal oscillator circuit, as the clock oscillation circuit of the time base generator, provides a reliable synchronous clock signal for all internal circuits of the microcontroller chip and for communication between the microcontroller and other digital systems or computer systems. The MSP430F169 microcontroller has three clock input sources: a low-speed crystal oscillator (32kHz), a high-speed crystal oscillator (450kHz~8MHz), and a DCO oscillator. A proper reset is required regardless of whether the system is powered on or off. The reset circuit of the CAT809 microcontroller used in this system meets the requirements. The power supply module is a crucial component of the data acquisition system's hardware design, directly affecting the system's accuracy and reliability. High output quality, good voltage regulation, high efficiency, low power consumption, high reliability, and miniaturization are its design principles. The data storage circuit ensures timely and reliable storage and protection of acquired data, a vital function of this system. The design uses the CH375 pure USB interface from Nanjing Qinheng Co., Ltd., whose main features are low price, convenient interface, and high reliability, making it particularly suitable for product modification designs.
Software Design
The main program is responsible for system initialization and task creation. The basic flow is shown in Figure 2. The main control unit's software design mainly includes keyboard scanning tasks, LCD display tasks, data storage tasks, and UART communication tasks. The data storage task and UART communication task are mainly introduced. Timely and reliable storage and protection of acquired data is a crucial task of this acquisition device. In the USB flash drive read/write mode, the USB flash drive is simply treated as a removable storage device, so the read/write method is similar to reading/writing flash memory; the operation is simple and fast, requiring only a few dozen statements to read and write data. However, the computer cannot directly read the written data. `voidx Write CH375 Cmd(UINT8mCmd)` writes a command to the CH375 chip: `{ P2DIR=0x0F; Set P2 port A0, CS, WR, RD to output control signals P4OUT=mCmd; Output data to the CH375 parallel port}` `void xReadCH375 Data(void)` reads data from the CH375 chip: `{ UINT8mData; P4DIR=0; Read operation inputs all data mData=P4IN; Input data from the CH375 parallel port P2OUT=0x07; Output invalid control signals to complete the operation. CH375 chip: A0(P2.3)=0; CS(P2.2)=1; WR(P2.1)=1; RD(P2.0)=1; return(mData); }`
The software design of the UART communication task data acquisition unit includes the acquisition tasks for 8 analog signals and 16 digital signals, as well as the programming of UART communication tasks. The UART communication tasks primarily facilitate data exchange between the data acquisition module and the main control unit. This design is a portable data acquisition device based on the principles of low power consumption and large-capacity storage, combining advanced embedded technology, microprocessor technology, and USB bus technology. The main functional modules were designed in principle, and some experiments were conducted to verify their suitability for complex measurement and control applications such as industrial control. In terms of software design, the application of μCOS-II improves the real-time performance of data acquisition. However, further research is needed on system function expansion and communication aspects.