Design of infrared temperature monitoring system based on C8051F340 single chip microcomputer

Publisher:dadigtLatest update time:2011-09-21 Keywords:C8051F340 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
0 Introduction
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.

a.jpg


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]

2 System Design
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.

b.jpg


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.

c.jpg

[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.

d.jpg



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.

Keywords:C8051F340 Reference address:Design of infrared temperature monitoring system based on C8051F340 single chip microcomputer

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

Application plan of low-frequency ultrasonic skin penetration promoting system based on C8051F340 microcontroller
Transdermal drug delivery systems have become an emerging and important means in the medical field. Transdermal drug delivery is a method in which drugs are absorbed through the skin and capillaries into the systemic circulation to produce drug effects. It can avoid the first-pass effect of the liver, extend the thera
[Microcontroller]
Application plan of low-frequency ultrasonic skin penetration promoting system based on C8051F340 microcontroller
System design of elevator remote control based on C8051F340 dual serial port
0. Introduction The remote elevator monitoring system is an advanced technology in the elevator field today. The computer located in the elevator center remotely monitors and controls the elevators in the building, monitors and analyzes the fault and operating status data, etc. It also controls the elevator
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号