Multi-point temperature acquisition system based on P89LPC922

Publisher:京玩儿Latest update time:2016-05-03 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  With the progress of society and the development of industrial technology, many products have stricter requirements on temperature range, especially in industrial development, such as metallurgy, steel, petrochemical, cement, glass and other industries. However, most of the temperature detection instruments on the market are single-point measurements, which cannot meet the high efficiency requirements of today's society, and the temperature information accuracy is not high. Therefore, it is necessary to design a measurement system that can measure multiple points of temperature at the same time, with high measurement accuracy and comprehensive processing of multiple points of temperature information. Here, a temperature acquisition system design that can collect and display multiple channels is proposed.

  1 System Hardware Design

  1.1 Overall system structure

  The system design adopts I2C bus, single host and multiple slaves working mode to realize multi-point temperature collection, reading and display. The host is composed of main controller, digital tube display, power supply, alarm, keyboard and other modules, and completes the following functions: 1) The host determines the node entering the temperature measurement state and the node to read the temperature by pressing the key: 2) The host reads the node temperature value from the bus and displays it; 3) When idle, it enters the time display state by pressing the key. The clock uses the real-time clock RTC inside the microcontroller and the external 6 MHz crystal oscillator. The CPU runs when powered off and wakes up every 0.5 s; the slave is composed of digital temperature sensors, etc., to complete the following functions: 1) Collect the real-time temperature value of the node; 2) Respond to the request of the host and send temperature data.

  The multi-point temperature acquisition system based on I2C bus uses P89LPC922 single-chip computer with hardware I2C bus function as the main controller, and uses digital temperature sensor LM75A and digital tube display driver and keyboard scan management device ZLG7290 with I2C function devices. LM75A collects the real-time temperature value of the node and sends the temperature data through I2c bus. ZLG7290 drives the LED digital tube to display the temperature value and time. SPXll17 is used to design the power module to provide 3.3V voltage. The hardware block diagram of the system is shown in Figure 1.

  1.2 Circuit design of each module

  1.2.1 Controller Module

  The main controller uses the P89LPC922 MCU. This MCU is a single-chip packaged microcontroller, suitable for those occasions that require high integration and low cost, and meets various performance requirements. It integrates keyboard interrupt, serial interface (UART/I2C), watchdog timer, and uses advanced 2-clock technology. The instruction execution speed is 6 times that of the traditional 80C51. It supports multiple power-saving modes such as idle, power-down, clock pre-division, etc. In addition, its 4 interrupt priority structure provides great flexibility for the processing of multiple interrupt sources.

  According to the keyboard interrupt characteristics of the main controller P89LPC922 microcontroller, the keyboard module can directly control three I/O ports to realize three buttons, and its schematic diagram is shown in Figure 2.

  This design uses a buzzer to implement the alarm process, and uses the open-drain method of the I/O port to control the buzzer. The indicator light circuit is composed of 2 LEDs, and the push-pull output method of the I/O port is used to drive the LED.

  1.2.2 Temperature acquisition module

  LM75A is a temperature-to-digital converter that uses a built-in bandgap temperature sensor and ∑-△ analog-to-digital conversion technology. This design uses two LM75A chips to collect temperature values ​​at two points. The schematic diagram is shown in Figure 3.

  1.2.3 Display Module

  ZLG7290B is a digital tube display driver and keyboard scan management device, which can directly drive 8-bit common cathode digital tubes (or 64 independent LEDs). Here, only the digital tube display driver function of ZLG7290B is used, and its keyboard function is not used, so the circuit is greatly simplified, and its schematic diagram is shown in Figure 4.

  2 Software Programming

  I2C is a multi-master bus that can be controlled by multiple devices. General I2C devices have a unique address to ensure the accuracy of control. The normal I2C bus transmission rate is 100 Kbit/s. In the newly added high-speed mode, it can reach a rate of 3.4 Mbit/s to support some high-speed transmission applications, such as large-capacity Flash memory.

 

  The LPC900 series MCU integrates the I2C bus internally, and can be used as both a master device and a slave device on the I2C bus. It has four I2C bus transceiver modes: master transmitter mode, master receiver mode, slave transmitter mode, and slave receiver mode.

 

  The I2C software package of this design adopts the hardware I2C bus interrupt mode. The bus competition and synchronization logic of the hardware I2C cannot be simulated by software. This software package works in the master mode of the hardware I2C. It includes applying for the bus, sending byte data, receiving byte data, etc., and facing other module programs are several normalized subroutines, which can be called by setting a few entry parameters.

 


  Figure 5 and Figure 6 are the real-time clock and keyboard interrupt service processes, respectively. The real-time clock generates an interrupt every 0.5s, and the keyboard uses three keys, each of which can generate an interrupt when pressed. The main function of this design completes the CPU power-off operation to minimize system power consumption. The CPU will only be woken up when there is a key interrupt and a real-time clock interrupt.

  3 System Testing

  3.1 Hardware Testing

  Use a multimeter to test the soldered circuit board. First, test the circuit part. Each circuit is connected normally without short circuit or open circuit. Secondly, after power on, the power light is on, proving that the power connection is normal. The power supply voltage input is 5 V, the output is 3.3 V, and the power supply circuit works normally. The remaining modules pass the software test.

  3.2 Software Testing

  The transmission of the I2C bus is verified by the ZLG7290 test program, and its timing is observed using a logic analyzer, as shown in Figure 7.

  As can be seen from Figure 7, the timing part completes the process of making the first digital tube display "0", a complete process from starting the bus to ending the bus. In this process, a total of 4 bytes of data are sent. After the bus is started, the slave address of ZLG7290 is sent, followed by a read-write bit 0, which represents the first address of the command buffer. After each byte is sent, a response bit 0 will be received, indicating that the data has been received. The following 2 bytes are compound instructions, which are bit-by-bit data download and decoding instructions, even if the first digital tube displays 0. After sending the instruction, the end bus condition follows, indicating that the sending process is over.

  The LM75A test program sends data to the slave. After receiving the response bit 0, the slave sub-address is sent immediately. Here, it is the first address of the ZLG7290 command buffer. After each byte is sent, an response bit 0 is received, indicating that the data is received. The following two bytes are compound instructions, which are bit-by-bit data download and decoding instructions, even if the first digital tube displays 0. After sending the instruction, the end bus condition is followed, indicating that the sending process is over. Verify the process of receiving data on the I2C bus, and use a logic analyzer to observe its timing, as shown in Figure 8.

  As can be seen from Figure 8, this timing part completes the process of reading the temperature value, and is also a process of receiving data with a repeated start condition on an I2C bus. This process is divided into two parts: sending and receiving. The sending part includes sending the slave address and the slave sub-address, that is, the address 90H of the LM75A and the first address 00H of the LM75A temperature register. Then restart the bus to prepare for receiving data. In this part, the host first sends the slave address, followed by the read-write bit 1, indicating that the host will receive the data sent by the slave. Then the host receives 2 bytes of data. After the host sends the response bit, it sends a stop condition to end the bus, indicating that the host has received the data once.

  3.3 System comprehensive test

  Burn the program into P89LPC922. After power on, the digital tube displays "0000". Use buttons 2 and 3 to set the initial value of the clock. When the temperature value read exceeds the set temperature range, the buzzer will sound an alarm. At this time, you can cancel the sound by pressing button l and switch to clock display.

  4 Conclusion

  This system is a measurement system that comprehensively processes multi-point temperature information. The design system has a simple structure, convenient operation, high measurement accuracy, fast speed, and can realize alarm. The temperature measurement range of this system is -55~+125℃, and the measurement accuracy can reach 0.125℃. Due to the use of the I2C bus structure, the entire system occupies fewer I/O ports of the main controller, and the remaining I/O ports can be reserved for system expansion. This system can be used for temperature detection in the plant growth environment, and an alarm will be issued when the temperature exceeds the suitable growth range of the plant.

 
Reference address:Multi-point temperature acquisition system based on P89LPC922

Previous article:Summary of using MSP430 timer interrupt!
Next article:Freescale 9S12 Series MCU Application Notes (SCI) 3

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号