Design of Distributed Remote Measurement and Control System Based on ARM7

Publisher:疯狂小马Latest update time:2012-11-13 Source: 21IC Keywords:ARM7 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. Introduction

Remote measurement and control is widely used in places where there are a large number of devices and they are widely distributed. With the development of computer and network technology, the use of local area networks can well solve the problem of centralized management and decentralized control. However, when the distribution of the measurement and control objects is greater than tens of kilometers, the use of local area networks is expensive and time-consuming, so it is not feasible. The measurement and control system composed of existing telephone networks, modems and computers can basically realize remote measurement and control management functions in places where the communication rate and real-time requirements are not high, and it is low-cost and has a short preparation period for use.

2. System structure

This system is designed for monitoring unmanned telecommunication room environments. The system host computer uses a microcomputer as the main control room monitoring host, and the lower computers are multiple measurement and control terminals distributed in various rooms.

The lower computers distributed in each computer room monitor the computer room environment parameters in real time, collect and store data, and upload data regularly; when connected point to point, the current status can be queried in real time. In order to facilitate the management of the lower computer, the lower computer needs to have an online control function, and all the parameters of the lower computer can be modified and controlled through the PC upper computer software of the monitoring center. Multiple lower-level measurement and control platforms transmit data with the upper computer through PSTN. Data interaction and fault alarm between devices all require reliable data transmission. Therefore, the reliability of the lower computer hardware and the reliability of the data communication link layer are crucial. The frame structure of the data and the software and hardware of the Modem control interface need to be carefully designed. In order to alarm the monitoring parameters in a timely and effective manner, three alarm thresholds with different severity levels need to be set for each monitoring parameter. When a real-time monitoring parameter exceeds the alarm threshold, the lower computer automatically alarms the monitoring center, and can dial three different phone numbers in priority order to notify relevant personnel. A password mechanism is used in the communication data frame. Only when the password is correct, the lower computer responds to the control of the upper computer, ensuring the security of the system.

3. System hardware design

The hardware block diagram of the lower computer is shown in Figure 2. The Philips 32-bit microprocessor LPC2132 based on the ARM7TDMI core is used, which integrates 16K SRAM and has 128k bytes of embedded high-speed FLASH memory. Rich on-chip peripherals, very small packaging and extremely low power consumption, without external program memory and data memory, make it very suitable for miniaturized embedded fields. The amount of data collected by the system each time is small, and it is not appropriate to upload it to the upper computer once it is collected. For this reason, the power-off non-volatile EEPROM 24C256 is used to store the collected data. The analog signal is collected through the l0bit serial AID TLC 1543, and its 11 channels can be used to collect parameters such as power supply voltage, current, and room temperature of the equipment in the computer room. The switch signal is read directly from the GPIO (General purpose I/0) of the microcontroller, and the control signal is output to the 74HC595 through the SPI serial port and converted into a parallel control signal output. The key tone is obtained through the DTMF decoder MT8870 to obtain the key value for alarm phone confirmation.

The external modem is connected to the processor through the RS-232C port. LPC2132 has two serial ports with 16-byte transceiver FIFO. Among them, Uart2 adds a modem interface with RTS, CTS, DSR, DCD, DTR, RI standard RS-232C interface handshake signals. Modem and microcontroller need at least three signal lines: TXD, RXD and SGND to achieve two-way communication. Since there is no handshake signal, this connection can only guarantee the reliability of single byte transmission. For the transmission of large amounts of data, data loss may occur. Although software processing can be used, it will take up CPU time and reduce CPU efficiency. Therefore, Uart2 is connected to the modem through the 8-way level conversion chip MAX3238, so that it has a complete RS-232C control communication signal line, which ensures the reliability of large data transmission.

4. Data frame encoding method

The principle of data frame coding is to minimize the bit error rate during data transmission, taking into account other aspects such as transmission efficiency and encryption. The data frame structure of this system is shown in Figure 3.

Figure 3 Data frame structure

The first and second bytes (packet header) and the last byte (packet tail) of the data frame use specific start codes and end codes, such as AAH, 55H, B5H, etc., which can effectively suppress various messy information. The data receiver can put the received data into a FIFO buffer. When a valid packet header is received, it starts receiving a data frame. Otherwise, it is considered to be interference or error code and discarded without processing. After the data frame starts to be received, it is considered a valid data frame only if the end code can be received correctly according to the data length. Otherwise, it is discarded and starts again to wait for the start code. The start code is followed by one or more passwords, which can be determined according to actual needs to increase the confidentiality of data transmission. [page]

The transmission of data often has bytes set to 0 continuously. This zero level is very easy to be interfered with and turned into other data during the transmission process. Therefore, the data is encoded in the remainder 3 mode. Parity check is applied to each byte of the data frame, and the cumulative sum and XOR sum of all data bytes are calculated and placed in the data frame for verification by the receiver.

5. Modem control and AT command set

Currently, the common modems on the market all support the AT instruction set, that is, all command lines are composed of the prefix "AT", which is the abbreviation of Attention. Its basic format is: AT command [parameter] command [parameter] ... terminator. The terminator is a single character, and its value is stored in register S3. The default is the carriage return character. Multiple commands can be included in a command line, but the number of characters that cannot be accommodated in the command buffer of the modem is generally 40 characters. The modem will automatically detect the baud rate, word length, and parity check from the two characters of AT, so the modem does not need to set these parameters.

The working state of the modem can be divided into command state and online state. In the command state, AT commands are received and executed. When the communication link is established, the modem enters the online state. At this time, the modem no longer interprets the data sent to it, but directly sends it to the remote receiving system. In the online state, if the state conversion sequence "++++" is received, it will enter the online command state. For a detailed introduction to the AT command set, see.

6. System software design

The LPC2132 microprocessor can operate at a frequency of up to 60MHz, has a 3-stage pipeline, and most instructions can be completed in a single cycle. It has 128KB FLASH program memory and 16KB SRAM on the chip. Its performance and storage space make the application of embedded operating systems possible. Currently, large-scale commercial embedded operating systems on the market are very mature, but expensive. Using free software with open source code is a good choice. uClinux is powerful and stable, but the code and required RAM are too large. uC/OS-II is simple and practical, and the kernel can be trimmed to only about 3K. The software of this system is based on the uC/OS-II embedded operating system, which is an ideal choice.

uC/OS-II is a preemptive real-time multitasking operating system with fully open source code, which is portable, curable and customizable. Up to 64 tasks with different priorities can be executed simultaneously. The communication and synchronization between tasks are completed through semaphores, mailboxes or queues. Semaphores are used to protect specific shared resources or synchronize other tasks. Mailboxes and queues are both used to send messages between tasks, but the former can only send one message, while the latter can send multiple messages. uC/OS-II requires a system clock (Clock Tick) to implement time delay and timeout confirmation. The higher the clock beat, the higher the system time accuracy, but the greater the system overhead. For detailed introduction, see the literature.

Under the management of the uC/OS-II operating system, this system is divided into 4 tasks:

Task 1: Collect and store data regularly. According to the collection frequency set by the host computer, collect and store various monitoring parameters regularly.

Task 2: Data frame processing, interpreting the data received by the serial port. After receiving a data frame with correct verification, perform corresponding operations, such as processing the control information of the host computer, setting system parameters, sending semaphores to other tasks, and sending correctly received response frames.

Task 3: Alarm task, real-time monitoring of various parameters, immediately reporting to the host computer when an abnormality is found, and making a call to the alarm.

Task 4: Automatically upload data. When a certain amount of data is collected, it is automatically uploaded to the host computer.

In a multi-task system, a periodic task interrupted by a clock is executed once at a certain time, and is in a dormant state at other times. If it is at the highest priority among all tasks, the strict time validity of the task can be guaranteed. Task 1 is such a task, so it is placed at the highest priority. It runs once at a certain time, that is, collects and stores data once, and is in a dormant state at other times.

In the process of communicating with the host computer, Task 3 and Task 4 both need the data frame processing task to interpret the data sent by the host computer, so Task 2 is the second priority. When the serial port interrupt receives the data sent by the host computer, it is put into the FIFO queue and a signal is sent to Task 2. When Task 1 is not executed, Task 2 immediately becomes the current running task and processes the data received by the serial port. It is in a waiting state at other times.

Automatic data upload does not require high real-time performance, so it is placed at the lowest priority. The alarm task is placed at the third priority, which can ensure that when an abnormality occurs, the upper computer and relevant personnel can be notified in time.

In a multi-task system, the protection of shared resources must be considered. Only one task can occupy this resource at the same time. In this system, the serial port is a resource that all four tasks need to occupy to control the Modem or transmit data to the host computer. The I2C bus is used to read and write monitoring data in the EEPROM in Task 1 and Task 4. Therefore, two mutually exclusive semaphores are established to protect the serial port and the I2C bus. When a task needs to use the serial port or the I2C bus, it first applies for the semaphore of the corresponding shared resource. If the signal has been occupied by another task, the task has to be suspended until the signal is released by the current user.

Arranging multiple tasks in this way fully utilizes system resources and ensures the coordinated and efficient operation of all tasks in the entire system and the real-time performance of the system.

7. Summary

After actual operation test, the system runs stably and reliably. The adoption of fully open UC/OS-II embedded operating system and multi-task management improves development efficiency, shortens development cycle and improves system performance. When upgrading the system, functions can be expanded by adding other tasks to the operating system, and the program has good readability and maintainability. The embedded system based on ARM7 and uC/OS-11 has a simple and compact structure, low cost and strong real-time performance, and is particularly suitable for the development of small and medium-sized embedded systems.

Keywords:ARM7 Reference address:Design of Distributed Remote Measurement and Control System Based on ARM7

Previous article:Design of CAN/PCI Intelligent Communication Card Based on ARM Controller LPC2294
Next article:Field Oriented Control of Brushless Motors Using an ARM7 Processor

Recommended ReadingLatest update time:2024-11-16 15:40

Embedded quantitative analysis system based on ARM7 chip S3C44BOX
Gangue is a solid waste discharged during coal mining and coal washing. It is a black-gray rock associated with coal seams during the coal formation process. There are more than 1,500 gangue mountains in the country, with a total volume of more than 3 billion tons, accounting for more than 40% of China's total indus
[Industrial Control]
Embedded quantitative analysis system based on ARM7 chip S3C44BOX
ARM7 VS Cortex-M3
To use a low-cost 32-bit processor, developers face two choices: processors based on the Cortex-M3 core or the ARM7TDMI core. How to make a choice? What are the selection criteria? This article mainly introduces some characteristics of the ARM Cortex-M3 core microcontroller that are different from the ARM7 to help you
[Microcontroller]
The relationship between ARM7, ARM9, ARM11 and ARM-Cortex
1. The relationship between ARM7, ARM9, ARM11 and ARM-Cortex     ARM7: ARMv4 architecture, ARM9: ARMv5 architecture, ARM11: ARMv6 architecture, ARM-Cortex  series: ARMv7 architecture  ARM7 has no MMU (memory management unit), and can only be called MCU (microcontroller). It cannot run modern multi-user multi-process o
[Microcontroller]
ARM7 Learning --- LPC2103 Time0 Timer Practice
Continuing to learn ARM7, I practiced the internal timer T0 of LPC2103, setting the timer to 1S to make the LED flash. The specific test procedure is as follows: /**************ARM7(LPC2103) exercise program**************************/ /****************************************************************/ /*****File
[Microcontroller]
ARM7 Learning --- LPC2103 Time0 Timer Practice
Design of MP3 player based on portable DAB receiver
  introduction   In recent years, Digital Audio Broadcasting (DAB) has attracted the attention of the international communication and broadcasting industry with its many advantages such as good sound quality, high sensitivity, and high spectrum utilization, and has made rapid progress. The "30~3000 MHz Terrestrial D
[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号