Design of 16-channel switching input signal acquisition system based on LPC2131 ARM microcontroller

Publisher:CrystalSparkleLatest update time:2023-04-03 Source: elecfansKeywords:LPC2131 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In large-scale industrial control systems, the starting and stopping of equipment at all levels have a certain impact on the operating status of the entire system. The collection of switching signals of these devices and the recording of action timing are also particularly important. Therefore, it is necessary to design a switching signal acquisition card to collect these signals to provide a basis for the detection, analysis, and query of equipment operating status and production accidents.


The 16-channel switching signal acquisition card introduced in this article uses Philips LPC2131 ARM microcontroller as the core. With a sampling period of 0.5ms, it can collect 16 switching input signals, measure the switching waveform and occurrence time in real time, and Upload the data to the host computer historical database with a resolution of 1ms. At the same time, historical data can be fully queried through cooperation with the host computer software to analyze system operation.


The measurement card has a UART communication interface and is networked with the controller. After the collected data is sent to the controller for processing, it is then sent to the workstation to display the status. At the same time, the time and status of the event are recorded, and the recorded data is stored in the workstation history. database.


Signal acquisition card

The acquisition card uses 16-channel LED lights on the main panel of the card to indicate channel signal status. At the same time, isolation is achieved between channels and between channels and the bottom plate, and electromagnetic shielding from the site is achieved. To ensure that the measured signal is not interfered with. The specifications of the capture card module are shown in Table 1.


At the same time, the acquisition card is connected to the controller through the UART communication interface, and the communication physical layer uses the CAN bus driver chip TJA1040 to send the collected data to the controller.


Capture card hardware design

The hardware circuit of the 16-channel switching signal acquisition card consists of five parts: signal acquisition circuit, microcontroller system, communication interface circuit, external pins, and human-machine interface. The schematic diagram of the hardware circuit structure is shown in Figure 1.

Design of 16-channel switching input signal acquisition system based on LPC2131 ARM microcontroller

Figure 1 Hardware structure diagram of switching measurement card

Switch signal acquisition circuit

The switching signal acquisition circuit is to collect various switching signals on site and send them to the processing chip. In the actual design, Philips LPC2131 ARM microcontroller is used.


The measurement principle of the signal acquisition circuit is: 16 on-site switching signals are connected to the card measurement terminals. Taking into account the fluctuation and interference of on-site signals, in order to ensure the stable and reliable operation of the system and prevent various on-site and power supply interference from affecting the system Impact, a photoelectric coupler is used in the channel to isolate the inside of the card from the field input signal, thereby achieving accurate measurement of the signal. In the actual design, the PS2701 photoelectric coupler is used, and the structural block diagram of the card measurement path is shown in Figure 2.

Figure 2 Switch signal acquisition circuit

Later, considering the simplicity of signal inversion, the photocoupler was changed to PS2705, which realized the function of signal inversion, so the actual measurement circuit was further simplified as Figure 3.

Figure 3 Simplified switching signal acquisition circuit

The signal after isolation and conversion by the optocoupler is connected to the data bus of the processing chip through a bidirectional bus driver, and the data is sent to the processing chip LPC2131 for processing. 


The single-chip system processing chip is Philips LPC2131, which is a microcontroller based on a 32-bit ARM7TDMI-STM CPU that supports real-time simulation and embedded tracking, and has 32kB of embedded high-speed Flash memory. A 128-bit wide memory interface and a unique acceleration architecture enable 32-bit code to run at maximum clock rates. At the same time, LPC2131 has strict control over the code size and can use 16-bit Thumb mode to reduce the code size by more than 30% with very little performance loss. The LPC2131's smaller package and extremely low power consumption make it ideal for use in small systems such as access control and POS machines. The wide range of serial communication interfaces and on-chip 8kB of SRAM make the LPC2131 ideal for communication gateways, protocol converters, soft modems, voice recognition and low-end imaging, providing them with huge buffer space and powerful processing capabilities. Multiple 32-bit timers, 1 or 2 10-bit 8-way ADCs, 10-bit DACs, PWM channels and 47 GPIOs as well as up to 9 edge or level-triggered external interrupts make it particularly suitable for industrial control systems.


The single-chip microcomputer system uses LPC2131 as the core and has 8K flash memory on-chip, so there is no need to expand the external ROM; to recall the historical data of the switching value, the relevant information must be easy to store and not easy to lose, so that it can be effectively stored after the system loses power. of saved data. The data information it measures includes the year, month, day, hour, minute, second, millisecond when the switching value occurs, as well as the switching value status of each channel at that time.

Figure 4 Microcontroller system circuit block diagram

At the same time, due to the influence of various interference and other factors during system operation, the program often runs away after running in an infinite loop. The system also uses a simple hardware WATCH DOG circuit.


Communication interface circuit

In order to enable the measurement card to effectively send the collected data to the controller, the card is designed with a UART circuit. Through the serial port, the card can complete tasks such as data transmission, parameter adjustment, and clock calibration according to the operating commands of the host computer.

The card uses TJA1090 communication chip, which is specially designed for serial communication mode. The output end is also connected with a voltage regulator protection circuit. The interface circuit is shown in Figure 5.

Figure 5 Communication interface circuit

Card module specifications and external circuit pins

The card is connected to the card base through dedicated pins to transmit the collected signals. The external circuit pins of the card are shown in Figure 6.

Figure 6 External circuit pin diagram

Human-machine interface

The card uses serial port communication to communicate with the controller, and then uploads the measured signal to the host computer, which is displayed on the configuration screen of the host computer. The human-machine interface is friendly, and the data can be used for system configuration, historical data query and other operations. At the same time, it can be implemented Process control SOE query, through the accompanying SOE software, can achieve functions such as jitter removal, peak clipping, and valley clipping, and realize SOE accident recall and query, and its accuracy can reach 1ms level.


Capture card software design

The card software design adopts a functional module structure. All software includes main program, interrupt service subroutine, etc. The main program is used to patrol and execute the commands sent by the host computer. The interrupt service subroutine is divided into an overflow interrupt subroutine and a serial port interrupt subroutine. The former is used to collect switch value jump signals, and the latter is used to receive data from the host computer.


main program

After the card is charged, enter the main program. First, determine whether the card is a power-on reset. If it is not a power-on reset, it will directly enter the patrol detection stage after the crash recovery process; if it is a power-on reset, the card will first perform self-test and initialization, including setting the stack pointer and clearing the card. Memory, set time constants, etc., and then allow interruption and enter the normal circuit processing program, which can realize parameter setting, switch jump time, status collection and other functions. If it is detected in the main program that the received data flag bit defined in the program is set, it indicates that the microcontroller has received the data sent by the host computer, and the data receiving process is completed by the serial port interrupt subroutine. According to the data from the host computer, the measurement card responds accordingly, or sends back data, or sets parameters.


interrupt service routine

The signal collection service subroutine mainly completes the collection of switching signals that occur, and is implemented by overflow interrupts, which are interrupted every 0.5ms.


The communication service subroutine mainly refers to the subroutine for receiving data from the host computer, which is implemented by serial port interrupts. Most of the data sent back to the host computer is switch record information, the amount of data is large, and it is mainly completed in the main program. At the same time, you can set the baud rate during communication, which can be achieved in the card parameter settings.


Conclusion

At present, the card has been put into use in the desulfurization monitoring system of units #10 and #11 of Nantong Tianshengang Power Plant in Jiangsu Province. All performance indicators meet the original design requirements, and the operation is reliable and in good condition. It can be widely used in the industrial processes of chemical industry, metallurgy, electric power and other industries to realize functions such as switching value collection and accident recall.


Keywords:LPC2131 Reference address:Design of 16-channel switching input signal acquisition system based on LPC2131 ARM microcontroller

Previous article:Teach you how to use the LPC54102 dual-core kit firmware library SPI
Next article:Application solution for robot arm controller based on LPC2138 microprocessor

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号