|
GPRS (General Packet Radio Service) is a wireless transmission method developed using the concept of packet switching. The GPRS network is implemented based on the existing GSM (Global System for Mobile Communications) network. Some nodes need to be added to the existing GSM network, such as GGSN (GPRS Gateway Support Node) and SGSN (GPRS Service Support Node). The main function of SGSN is to record the current location information of the mobile terminal and complete the sending and receiving of mobile packet data between the mobile terminal and GGSN. GGSN mainly acts as a gateway and can be connected to a variety of different data networks, such as ISDN (Integrated Services Digital Network), PSPDN (Packet Switched Public Data Network) and LAN (Local Area Network). GGSN can perform protocol conversion on GPRS packet data in the GSM network, thereby transmitting these packet data to the remote TCP/IP or X.25 network.
The GPRS network not only has the advantages of wide coverage, fast data transmission speed, high communication quality, always online and billing by traffic, but also is itself a packet data network that supports TCP/IP protocol and can directly communicate with the Internet. Therefore, CPRS has an unparalleled cost-effective advantage in industries such as wireless Internet access, portable environmental monitoring, traffic monitoring, and mobile office.
1 GPRS communication system hardware design
The system uses Sony Ericsson's GPRS communication module GR47 with an internal TCP/IP protocol stack and PIC18f6720 microcontroller, both of which support RS-232 communication standards.
The core design lies in the connection between the microcontroller and GR47 and the writing of software. The PIC18f6720 microcontroller has two USARTs (universal asynchronous serial interfaces), one of which is connected to the GR47 module for data and AT command transmission; the other is connected to the serial port of the terminal chip to communicate with the terminal. An antenna needs to be installed on the outside of the GR47 module. As shown in Figure 1.
The PIC18F6720 microcontroller controls the GR47 module to send and receive data, and the serial port interrupt is used in the software to realize data transmission and forwarding.
1.1 Introduction to PIC18F6720 PIC18F6720
is a high-end single-chip microcomputer produced by Microchip. It uses 3.3 V power supply, most of its instructions are single-cycle instructions, and almost all related hardware configurations are mapped into special registers, which greatly improves the running speed; it has 7 programmable I/O ports A, B, C, D, E, F, G; in addition to 3840B of RAM, it also has 1024B of EEPROM and 128 kB of Flash memory; it has 4 timers and multiple interrupt sources and 2 interrupt priorities, and 2 USARTs. It is very powerful and is a very cost-effective chip.
1.2 Introduction to GR47
GR47 is a dual-band GSM900/GSM=1800 communication module produced by Sony Ericsson. Based on this module, GPRS data transmission can be carried out, and it has functions such as supporting short message services. It is powered by 3.6 V voltage; it can provide multiple interfaces, such as antenna interface, analog audio interface, asynchronous serial interface, SIM card interface, etc., and it also supports I2C communication; it integrates TCP/IP protocol stack internally, so the use of this chip will greatly reduce the difficulty of microcontroller programming.
There are not many ports of GR47 used in this scheme, and several key connection points are explained as follows:
a) Serial port TD: connected to RX2 of the microcontroller, RD connected to TX2 of the microcontroller.
b) DSR pin: DataSetReady, indicating that the module is ready to receive data. This pin is connected to RB0 of the microcontroller through a transistor switch circuit. DSR is high to indicate that it is in data mode, and low to indicate that it is in command mode.
c) DTR pin: Data Terminal Ready, indicating that the terminal device is ready to receive data. The data state and command state of GR47 can be switched by controlling the high and low time of the level of this pin. This pin is connected to RF2 of the microcontroller through a transistor switch circuit.
2 GPRS communication system software design
The system software is written in C language and compiled in MPLAB environment. Since this system is a module of the remote management terminal, certain protocols must be followed in the programming of the program to ensure correct communication. The main body of the program is how to control the AT commands of GR47 to perform initial settings on GR47 and process information data. The program can be generally divided into the following blocks: initial settings of CPRS connection, judgment and processing of short messages, heartbeat processing when there is no data transmission, data judgment and forwarding, etc. The main program is to organically combine these program blocks together, control each other, and loop infinitely. 2.1 Establishment of connection The implementation
process of the GPRS module connecting to the Internet and GPRS network is as follows:
a) The single-chip microcomputer software controls the GR47 module to start up and wait for the module to start normally.
b) Through the serial port connected to the single-chip microcomputer and the GR47 module, write the corresponding AT setting command to the GR47 module for initialization, so that the module can successfully adhere to the GPRS network, obtain the dynamic IP address assigned by the network operator, and establish a connection with the destination terminal.
2.2 Data Processing
The transmission of data packets in the data center server and GPRS server is based on IP data packets, but it is not advisable to transmit IP packets in plain text. Therefore, PPP (point-to-point protocol) is mostly used for transmission to achieve transparent transmission of data through the GPRS module and the Internet network. GR47 has an internal integrated TCP/IP protocol stack, so users do not need to write programs related to the IP protocol, and can directly transmit data through GR47.
a) Data transmission between the module and the PC on the Internet: The PC is required to have a public network IP address and an open port as well as running software to monitor the transmission message. In this way, when the module transmits data with the Internet, the message will be displayed. After the module is successfully connected to the network, the microcontroller only needs to send the data to be sent to GR47 through the serial port, and GR47 will forward the data to the PC with the corresponding IP address.
b) Processing of short message data: GR47 has the function of GSM and can send and receive short messages with mobile phones. Short messages use the PDU format. In the program, it is necessary to determine the arrival of short messages and read the content of the short messages, and execute the corresponding functions according to the content. Finally, the results are constructed into the PDU format and returned to the corresponding sender
. c) GPRS communication heartbeat information: After the network connection is established, if there is no data communication within the set period, the GPRS module sends a heartbeat message to the data service center. After receiving the heartbeat message, the data service center responds with an answer signal.
d) Storage of important data: In the program, some important, commonly used and changeable data such as the IP address, port number, terminal address, SIM card number, etc. of the computer server are stored in the EEPROM of the microcontroller. When necessary, read out or rewrite data to the EEPROM for setting.
2.3 Main program flow
The main program consists of module functions, and module functions are composed of nested basic functions. The main program flow is as follows: first, initialize the variables of the MCU, which are usually 0; initialize the corresponding configuration units of the MCU, such as setting the port direction, setting the interrupt priority, initializing the timer, etc.; then the MCU controls the power supply of GR47 to decide whether to start the machine; after the machine is successfully started, check whether the network registration is successful; after success, the connection between the module and the PC server can be established, and data transmission and short message processing can be carried out; send heartbeat information in a certain format as needed. See Figure 2.
3 Conclusion
This paper presents an implementation scheme of an embedded wireless data transmission terminal based on a single-chip microcomputer and a GPRS module. The small GPRS communication system centered on a single-chip microcomputer application system has low cost, short design cycle, and good portability, and is particularly suitable for remote control and data transmission.
Previous article:Using the MCLR pin as an output on a PIC microprocessor
Next article:Servo control based on single chip microcomputer
Recommended ReadingLatest update time:2024-11-16 19:28
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
- Let's see! Detailed explanation of the components of a switching power supply
- SCI Interface and Hardware Implementation of TMS320C6711D
- Non-magnetic AC/DC Power Supplies
- S5PV210 Timer
- [CY8CKIT-149 PSoC 4100S Evaluation] + Create a blank project (taking Key-LED as an example)
- The difference between IPV4 and IPV6 of TCP/IP protocol
- How to set numpy floating point precision?
- EEWORLD University----[High Precision Laboratory] Sensor Technology: Temperature Sensor
- TI Award Live Pre-registration: C2000 F280013x enables lower cost and more efficient real-time control solutions
- Such an honest manufacturer is rare.