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.
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.
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.
[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.
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.
Previous article:Design of vegetable greenhouse control system based on AT89C51
Next article:Kitchen timer based on AT89C2051 microcontroller
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Basic Concepts of RF Power Amplifier
- Is there any abnormal interference signal output from the GD32F350 pin?
- [RVB2601 Creative Application Development] 3. Continuously expand the routine sound and adjust the volume
- Mir MYC-YT507 development board review: Performance test 2 Qt performance test
- PMU Power Management Unit Layout
- Questions and answers about CCS project COFF and ELF output formats
- Request a free ZVS buck regulator evaluation sample!
- Is there anyone familiar with Trinamic TMC5160/5130/2160?
- [Shanghai Hangxin ACM32F070 development board + touch function evaluation board evaluation] MDK development environment test LCD Demo
- [Environmental Expert's Smart Watch] Part 13: Storing various data in EEPROM