Wireless Data Transmission System Based on C8051F02X

Publisher:MeshulunLatest update time:2011-07-22 Keywords:C8051F02X Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

This article introduces a wireless data transmission system based on C8051F02X, which applies computer technology and GSM network communication technology. It is a new type of wireless communication system. The system relies on the GSM network and uses short messages for data communication, that is, a GPRS module that supports short messages, data communication and other services is added to the traditional single-chip data acquisition system, and an independent SIM card is allocated to it. Combined with the single-chip system through the serial communication interface, remote wireless transmission of data is realized.

The data transmission system introduced here is an important part of the monitoring system. It is a complete system with both monitoring and powerful management functions. It consists of a master control system, a GSM communication network, and a remote monitoring terminal system. The monitoring terminal performs two-way information transmission with the master control monitoring center through the GSM network. It sends the collected data information to the monitoring center, and receives the operation commands from the monitoring center to perform corresponding operations on the controlled equipment. The entire system realizes the following main functions:

Data acquisition receives field data collected by the data collector through the serial port.

The system sends real-time data to the master terminal in the form of short messages via the GSM network at regular intervals (0:00, 8:00, 16:00). If the master terminal does not receive the short message within the specified time, the master terminal will return the message to the system, and the system will resend the data after receiving the message.

The data remote query operator can operate the main control software in the duty room at any time and send commands to query the current data collected by the remote data collector. After receiving the command, the system will send the collected current data to the main control end.

The remote control operator can operate the main control software to send parameter values ​​used to monitor the controlled object to the system. After receiving these parameter values, the system transmits them to the data collector through the serial port, thereby realizing remote control.

The data recording host software stores the received data in a database for future retrieval and viewing.

2 System Hardware Structure

FIG. 1 is a hardware connection diagram of the wireless data transmission system used.

Hardware connection diagram of the wireless data transmission system used

As can be seen from Figure 1, the system consists of two parts: a control module and a data transceiver module.

The control module is mainly composed of C8051F021 microcontroller and DSl2887 clock chip. It mainly controls the time when the data transceiver module sends data. At the same time, it can also be connected to the host computer through the serial port to control the relevant parameters of the data collector through the host computer.

The data transceiver module is mainly composed of C8051F020 single-chip microcomputer, data collector and GPRS module. The data collector sends the collected data to the single-chip microcomputer through serial port 0. After the single-chip microcomputer processes the received data, it sends the corresponding AT command to the GPRS module through serial port 1. Then the GPRS module sends the data to the receiving end in the form of short messages through the GSM network.

The control module and the data transceiver module communicate through SPIO, where C8051F021 is the host and C8051F020 is the slave. The master control module mainly sends two types of control information to the data transceiver module:

(1) When it is time to collect data, a character 'S' is sent to the data transceiver module. After receiving the information, the data transceiver module sends the data received at that moment to the remote terminal via the GPRS module;

(2) When the relevant parameters of the data collector need to be modified, the modified parameters are sent to the data transceiver module in a certain format. After the data transceiver module makes a judgment, it sends the information to the data collector through serial port O. [page]

2.1 C8051F02X MCU

The system MCU chip C8051F020 of Cygnal Company in the United States is a fully integrated mixed signal system-on-chip MCU chip, which is a real system-on-chip (SoC) that can work independently. Compared with ordinary single-chip microcomputers, it has the advantages of high speed, strong functions, complete peripherals and functional components, few expansion chips, easy upgrade and maintenance, etc., and its on-chip debugging function allows designers to perform non-intrusive, full-speed in-system debugging through the JTAG interface. It is an efficient and reliable digital signal processing chip for complex systems.

The main reason for choosing this microcontroller as the MCU in this system design is that, on the one hand, CIP-51 is fully compatible with MCS-51 instructions, and the standard 8051 assembler, compiler and software package can be used for software development, which is also convenient for users to transplant software; on the other hand, it can make full use of its rich general digital port resources without address/data line multiplexing, and the design of its peripheral circuits can be greatly simplified. The rich port resources of C8051F02X and the flexibility of their allocation are achieved by using a priority cross switch decoder, and all pins use 5 V voltage and can be configured as open drain or push-pull output mode and weak pull-up.

2.2 DSl2887 clock chip

DSl2887 is a clock chip launched by DALLAS. The chip has built-in crystal oscillator and battery, so there is no need to worry about power failure and stopping. It also provides 114 B general non-volatile RAM, and can complete leap year compensation and automatic adjustment of daylight saving time. It supports Motorola and IN2TEL bus timing. These advantages make this chip widely used in the field of industrial control. The circuit connection between the clock chip and the microcontroller is shown in Figure 2.

Circuit connection between clock chip and microcontroller

2.3 MC35i module

MC35i is the first GPRS module of Siemens. It not only supports GPRS technology, but also has all the functions of TC35i: it can provide data, voice, short message and fax services on GSM network; it adopts standard industrial interface and is easy to integrate. MC35i supports GSM900 and GSM1800 dual-band networks, has built-in S1M card reader and supports plug-and-play features. It can be used as a universal dual-band module to transmit data simply and quickly.

MC35i has 40 pins, which are connected through a zero insertion force (ZIF) connector. These 40 pins can be divided into five categories, namely power supply, data input/output, SIM card, audio interface and control. Among them, pins 18 and 19 are connected to the serial port 1 of C8051F020 as input/output pins respectively; C8051F020 controls data transmission by sending AT commands to pin 18 of MC35i, and judges whether there is a new SMS and reads the SMS content according to the return data of pin 19. Pin 15 is the ignition line IGT (Ignition), which is a control pin and is connected to the P1.5 pin of C8051F020; when MC35i is powered on, a low level of more than 100 ms must be given to IGT before the module starts.

3 System software design

This design is divided into two parts: the host and the slave. The host part is mainly used to control the data sending time and data acquisition parameters, while the slave part is mainly used to receive and send data.

3.1 Communication protocol settings

In order for the host and slave to communicate with each other, the protocol used to transmit data must first be specified. Generally speaking, the host sends commands and configuration information to the slave, and the slave sends feedback information to the host.

This system mainly realizes the control of the data transmission time of the slave by the host. When the host responds to the interrupt request of the clock chip DSl2887 and enters the INTO interrupt service program, the host sends a character 's' to the slave. After receiving the instruction, the slave starts to send data. At the same time, a communication protocol is also required between the data transceiver module and the receiving terminal to ensure the reliability of transmission. When the receiving terminal does not receive data within a certain period of time (such as 5 minutes), it sends a short message with the content of 'N' to the data transceiver module, indicating that the data should be resent. After receiving the short message, the data transceiver module extracts the content of the short message and determines whether it is 'N'. If it is, the data is resent. The communication between the slave and the data collector also stipulates the corresponding protocol. There are corresponding start bits and length bits before each group of data. The slave ensures the correctness of data reception by judging the start bit and length bit of each group of data.

3.2 Software Design of Host Part

In the host part, the key point is how to initialize the clock chip. During the initialization process, the periodic interrupt and the clock update end interrupt are turned off, and the time interrupt is set to once every hour. After each interruption, the hour value is read to determine whether it can be divided by 8. If it can be divided, it means that the time is 0:00, 8:00 or 16:00, then the control information 'S' is sent to the slave to notify the data transceiver module to send data. The flow chart of the host's INTO interrupt service program is shown in Figure 3.

Host's INTO interrupt service program flow chart

[page]

3.3 Software Design of Slave Part

In the slave part, the data of the data collector is received through serial port 0 and refreshed continuously. When the slave receives the command 'S' sent by the host, it sends the corresponding AT command to the GPRS module through serial port 1, and sends the current data to the remote terminal in the form of a short message. Since GPRS can only send character data, if the data sent is greater than 127, the sending will fail, so each data is converted into the corresponding character for sending. For example, the hexadecimal number 9F is converted into the characters 9 and F and then sent. After the terminal receives it, it can be converted into the hexadecimal number 9F if necessary.

Another function that the slave needs to implement is data retransmission, which is implemented in the serial port 1 interrupt service program. Therefore, there are three interrupt service programs in the slave program: serial port 0, serial port 1, and SPIO. Among them, the serial port 0 interrupt has the highest priority, followed by the SPIO interrupt, and the serial port 1 interrupt has the lowest priority. The serial port 0 interrupt occurs almost continuously, so the interrupt priority of the serial port 1 interrupt and the SPIO interrupt must be set to 1 (the default is 0) to make the CPU respond to the serial port 1 interrupt and the SPIO interrupt first, otherwise the interrupt requests of the serial port 1 interrupt and the SPIO interrupt will hardly be responded to.

The flow chart of the serial port 0 interrupt service program is shown in Figure 4.

Serial port 0 interrupt service program flow chart

4 Conclusion

This system uses industrial-grade chip C8051F02X series microcontroller combined with GSM network to realize wireless data transmission. The system is stable and reliable. In many application fields, such as hydrological monitoring, geological exploration, etc., this system can be used to complete remote data collection and real-time transmission of collected data through wireless transmission.

Keywords:C8051F02X Reference address:Wireless Data Transmission System Based on C8051F02X

Previous article:Design of vegetable greenhouse control system based on AT89C51
Next article:Kitchen timer based on AT89C2051 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号