During the spiral charging process, bubbles often appear in the medicine due to the uneven temperature distribution of the internal medicine, which seriously affects the quality of the medicine in the projectile and the parameters of the ammunition. Therefore, this paper hopes to detect the temperature of the medicine in the cavity by designing a temperature monitoring system, and find the relationship between the temperature and the quality of the medicine during the charging process. Due to the particularity of the charging machine structure, we cannot obtain the temperature of the medicine by the traditional contact temperature measurement method. Therefore, this paper designs a system based on the infrared temperature measurement method to realize the real-time detection of the temperature of the medicine.
1 Time division multiplexing principle
The design of the multiplexing method is mainly based on the signal characteristics and interface characteristics of the TN9 infrared sensor. The TN9 infrared temperature sensor has 5 interfaces, of which the power supply and ground do not need to be connected to the CPLD, and the other three interfaces are the low-level effective TN9 work enable interface, the SPI clock interface and the data interface working in the master mode. The multiplexing mode is to connect these interfaces with the same function to the same module by setting the appropriate timing and gate circuit control.
In actual applications, when EA is valid, the TN9 sensor sends temperature data twice through the SPI bus at about 180ms and 560ms, the first time is the ambient temperature data, and the second time is the target temperature data. When EA is invalid, the sensor still sends data, but the data sent is meaningless. At this time, it is necessary to shield the useless signal through appropriate gate circuit control. When multiple acquisition channels are used, the number of pins and control gate circuits required will increase greatly as the number of sensors increases. In order to meet the needs of precise time control and multi-gate selection circuits, the data acquisition module uses CPLD to achieve simplicity and flexibility relative to single-chip microcomputers and gate circuits.
As shown in Figure 1, the dual-channel TN9 data receiving module is used as an example to illustrate the SPI bus multiplexing method. The EA signal is controlled by the time-sharing module. Since the VHDL language can be considered to establish a connection relationship for the internal logic unit of the CPLD, the statement itself does not consume system time when the system is running, so the time setting of the CPLD can be extremely accurate through the register setting. Here, the TN9 working cycle is set to 1s, and the 400ms time is high (EA is disabled). About 200 ms after the first sensor is started, the next sensor starts working in the same way, so as to ensure that the signals returned by different sensors do not overlap. Since TN9 will still send invalid data during the invalid period of EA, and the DATA line and CLK line on the SPI bus are high when idle, the gate circuit shown in Figure 1 is designed here to shield invalid information. [page]
The system is based on the C8051F340 microcontroller, which is connected to the CPLD and the computer through the UART bus and USB bus respectively.
2.1 Data acquisition module design
The core module of the data acquisition module is implemented by CPLD. After receiving the microcontroller control command, CPLD resets and starts working. The time-sharing module and gate circuit cooperate to realize the time-sharing start of the sensor and shield the ambient temperature data sent back by the SPI bus and the garbled code when the enable signal is invalid (high level). The SPI module realizes the slave device receiving function of CPLD, and stores the 16-bit temperature data sent back by TN9 into the register each time. After receiving the 16-bit temperature data, the register control module starts the serial port transmission and sends the high and low 8-bit data to the microcontroller respectively. The microcontroller performs corresponding processing in its interrupt function.
2.2 Microcontroller module design
The realization of USB data transmission function is the difficulty of this part. Here, the USBXpress and Configuration Wizard development kits provided by Silicon Laboratories are used in combination with the Keil uVision3 development environment to easily realize the configuration of the C80S1F340 microcontroller. In this way, the difficulty of microcontroller program writing and USB communication development is reduced. We only need to focus on the functional part we want to realize and do not need to understand the complex USB communication protocol.
[page]
As shown in Figure 3, the system initialization configuration is completed after the microcontroller is powered on. The initialization configuration statement can be configured using the Configuration Wizard. The UART0 interface (second function) of C8051F340 is fixed at P0^4, P0^5. USB can only use specific ports. There is no need to configure the port specifically here. Set its port mode to push-pull. Set the system clock to use the internal clock mode. Select the multiplexer and multiplier to make the USB clock work at 48MHz. As a slave device in the USB system, after the system initialization is completed, execute the wait command DisplayLED(), and then judge the operation to be performed in the USB in the interrupt function.
UART0 uses timer 2 as the baud rate generator and enables timer 0 interrupt. USB initialization first calls the API function USB_Clock_Start() provided by USBXpress, and then initializes its port. Here, the default settings provided by USBXpress can be used.
Since the temperature data is 16-bit data, the serial port receives 8 bits each time. Here, an array In_Packet[3] is defined. The last two bits are used to store the MSB and LSP values, and the first bit stores the sensor flag. When the In_Packet[3] array data is updated, the USBXpress API function Block_Write(In_Packet, 3) is called to send the temperature data to the host computer.
2.3 Host computer software design
USBXpress provides VC6.0 with a dynamic link library for USB communication. Here, a static method is used to load the dynamic link library. Therefore, the SiUSBXp.lib path provided by USBXpress needs to be added in the compilation options, and the header file siusbxp.h needs to be added when calling.
The program is written in accordance with the API functions provided by USBXpress. When the program interface is initialized, the SI_GetNumDevices() and SI_GetProductString() functions are called to obtain the USB device information. Since the sensor works at an interval of about 200ms, a 50ms timer is set here, and SI_Read() is executed in its response function. When there is data in the Buffer, the data will be read into the defined structure, and the Format command will be used to convert it into a string type and update the data to the edit box in hexadecimal format.
3 Summary
The system basically realizes the temperature collection and transmission functions, and can save the data through VC6.0 and provide it to mathematical analysis software such as matlab for data analysis. The experiment proves that the time-sharing control of the sensor can be realized very accurately using CPLD. C8051F340 uses the API provided by USBXpress for USB development, which greatly simplifies the development process.
The experiment only built a simple framework. Here, it only verifies the feasibility of collecting sensor data based on CPLD using time-division multiplexing method and using C8051F340 to communicate with the computer using USB bus. A lot of post-work is still needed to complete the perfect and stable system.
Previous article:Design of DC Power Supply Based on C8051F041 Single Chip Microcomputer
Next article:Application of 51 single chip microcomputer in the design of intelligent pressure sensor
Recommended ReadingLatest update time:2024-11-16 21:42
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- 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
- 【Silicon Labs Development Kit Review】+ Unboxing Review
- IME2020 Western Microwave Conference
- Does anyone know where the slope of 6db/oct in the red circle in this post came from? Can anyone teach me?
- 256Mx32 8Gb DDR4 SDRAM
- 【BearPi-HM Micro】Part 2: Building an OpenHarmony compilation environment from scratch
- Programmable limiter or selector, programmable frequency selector if there is an integrated chip
- MSP430 development tools and their features
- When voting for National Chip brands, Rockchip received a lot of votes. What is the demand for this company in the forum?
- Feedback and Op Amp in Circuits
- IIC interface driver design based on FPGA