GPS is the most mature and practical positioning system in technology. However, in the GPS positioning system, since it is a one-way navigation system, it transmits the ephemeris data to the ground receiver. In many specific applications, such as in the vehicle dispatch system, it is generally necessary to transmit the information data measured by GPS to the dispatch center. Since the system consists of a base station and multiple user stations, the connection between the base station and the user station, that is, the various correction values calculated by the base station are sent to the user station, all of which require the use of data links to complete data transmission. Among them, the data link consists of a modem and a radio station. In the wireless data transmission system, the modem is a key part. The modem encodes and modulates the data, and then inputs it into the radio station for transmission. The user station receives it, demodulates the data, and sends it to the GPS receiver for correction. This article introduces the principle and method of single-chip microcomputer control modem.
1 System composition
This system is mainly composed of a single-chip microcomputer and a modem. The single-chip microcomputer is P89C58, which is the main part of the control circuit. It controls the K224 chip and completes the initialization of each chip. It also has the function of interleaving and error correction coding of data. The connection between the single-chip microcomputer and the K224 interface is shown in Figure 1.
The whole system is divided into two parts, one is the main call structure and the other is the response structure. Figure 1 only shows the main call part. When working, first power on reset, P89C58 initializes K224 and initializes its own serial port.
The working process of the whole system is as follows: after receiving data from the GPS receiver, it is converted into TTL level through the RS 232 interface circuit (i.e., the level conversion circuit composed of MAX232) and sent to the RXD end of P89C58. After P89C58 performs group coding and interleaving coding on the data, it is sent to the TXD end of P89C58 for output. This output signal is sent to the TXD of K224, and after modulation, the modulated signal is output from the TXA end of K224. When the receiver receives the modulated signal from RXA, it is processed by K224, and after demodulation, it is sent to the RXD receiving end of P89C58 through the RXD port by K224. P89C58 performs de-interleaving and decoding on the data. After that, the data is sent out from the TXD port of the single-chip computer, and once again undergoes level conversion by ICL232, and is sent to the computer at RS232 level for calculation and analysis.
2. Initial setting of MCU
In this system, since P89C58 is used to initialize each chip and to complete the interleaving error correction function of the data, it is necessary to use the special function register of the microcontroller for setting, and at the same time, it is necessary to use the bit-addressable area of the internal RAM of the microcontroller to complete the interleaving encoding function. For the MCS-51 series of microcontrollers, the special function registers that control the serial port are SCON and PCON. PCON is the power control register, in which the D7 bit SMOD is the serial port baud rate coefficient control bit. If SMOD=1, the baud rate is doubled. The byte address of the special function register SCON is 98H and is bit-addressable. SCON is used to set the working mode of the serial port, receive and send control, and set the status flag.
Among the four working modes of the serial port, it is mainly used to expand the parallel input and output port. Considering the above parameters, we set the microcontroller to work in serial mode 1, that is, the data format of one frame is: 1 start bit, 8 data bits, 1 stop bit, and no parity check. Since there is no data format with 2 stop bits in the four working modes of the microcontroller serial port, we don't need to deliberately use mode 3 to make up 2 stop bits and replace the stop bit with one bit in the 9-bit data format. In addition, if this one stop bit is saved, since the data format output by the GPS navigator is 2 stop bits, and the microcontroller works in mode 1, when it receives 1 stop bit, it is considered that a frame of data has been received, so there is 1 stop bit time for other processing. For data with a baud rate of 2400 b/s, the code element width is 1/2400=0.42 ms, and for data with a baud rate of 1200 b/s, the code element width is 1/1200=0.83 ms. In this system, since a 11.059 2 MHz crystal oscillator is used, its machine cycle is approximately 1μs. After comparison, it can be seen that the saved time has a certain utilization value, so there is more time for interleaving error correction coding processing. Since the system receives data in an inquiry mode when working, that is, after power-on reset, it continuously detects whether there is data input until data input is detected. In this way, if there is more time for data processing, some data will not be missed due to data processing and thus lost.
The baud rate of the received data in this system is set to 1 200 b/s and 2 400 b/s. Timer T1 is used as the baud rate generator. T1 works in the automatic reload mode 2. TL1 is used for counting. When the automatic reload value is placed in TH1, the overflow rate can be determined by the following formula:
Overflow rate = counting rate / [256-(TH1)]
The baud rate is determined by the following formula:
Baud rate = (timer/counter 1 overflow rate)/(32/2SMOD)
SMOD is the 8th special bit in the special function register PCON. 3 Design of interleaved error correction coding
Error correction coding is a technology to improve the reliability of digital transmission and an important means to correctly transmit differential GPS correction signals. During data transmission, sudden errors often occur due to the internal noise of the transmission channel and the inter-symbol interference caused by it, as well as the interference of the external transmission environment. In order to improve the anti-interference ability, we use interleaved error correction coding to disperse a series of errors into multiple codewords, and then use codewords that can correct fewer errors for encoding, so that it is possible to correct codewords with longer errors. For example, given a (n, k) linear block code, we can use interleaving to disperse a single burst error of length bλ into λ (n, k) codewords, so that each (n, k) codeword only has a burst error of length b, which improves the system's anti-interference ability and improves the system's error correction ability.
The internal data memory of MCS-51 microcontroller is generally 256 B, which is divided into 128 B of internal data memory and 128 B of special function registers. For P89C58, its addressable data storage space can be expanded to the upper 128 B. In the internal data memory, 20H~2FH (16 units) are general working units, which can be addressed by the CPU by byte or directly by bit for bit operation. We use 20H~27H to form the interleaved coding space. [page]
Through 8×8 rectangular data units, data is placed in rows (columns) in a loop, and then read out in columns (rows) in a loop, so that data is placed in rows and columns, or read out in columns, thus completing interleaved error correction coding. In this process, attention should be paid to the coordination of time. The processing time of data and the sending time of data should be coordinated, otherwise the data cannot be received normally.
4 Modem Design
There are 8 8-bit registers in K224. The operation of K224 is completed by initially setting these 8 registers and determining the working status.
The two modems are set to work in calling and answering modes respectively, INT (interrupt) is disabled, the scrambler is used, the defense tone is disabled, the answer tone generator is turned off, and DTMF is turned off. At the same time, the receiving and sending use the same decision plane, and the adaptive equalizer is turned on.
Before the Modem transmits data normally, the two Modems and the Modem and DTE need to make necessary contacts in order to determine the speed of both parties. This is called handshake. During the handshake process, the microcontroller P89C58 must detect and confirm the determined signal to control the handshake process and the state of the Modem. The microcontroller P89C58 reads the bits of the detection register of K224, but it is far from enough to take actions related to the state immediately after only detecting that a certain bit is in the pre-status (1 or 0). There are two reasons for this: first, during the handshake process, the detected signal must be stable for a period of time; second, due to noise interference, some bits may change from 0 to 1 or from 1 to 0. Therefore, the microcontroller needs to confirm the state of the bit of the detection register and continue to detect whether the signal lasts for a corresponding time.
Therefore, it is necessary to design a method to detect the handshake sequence. This paper adopts the method of increasing the counter, that is, converting the duration of the signal into a preset value, and then setting a counter, which increases by 1 every time a signal is detected. When it increases to the preset value, it can be considered that the signal is detected.
The specific calculation method is as follows: Each signal that needs to be detected during the handshake process has a required duration, and there is a delay when this signal reaches the receiver and is detected by the detector. The delay time is subtracted from the duration of the signal, and then the sampling frequency of the signal is multiplied by the value. The sampling frequency should be greater than or equal to the data rate of the detected signal. The above program settings are initialized by P89C58 after the system is reset. Figure 2 is a flow chart of the system operation.
5 Conclusion
This system has been simulated by Star51PH MCU simulator and programmed by TOP2005 programmer. The results show that the system is feasible. The modem can receive and send data stably at 1200 b/s. When working at a higher rate, the data cannot be stably received for a long time. Further experimental verification is needed. The system has a simple design structure and stable and reliable performance.
Previous article:Application of proximity switch in motor speed measurement based on single chip microcomputer control
Next article:Design of electronic calendar system based on AT89S52 single chip microcomputer
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
- MCEWizard software usage for EVAL-M3-TS6-665PN development board
- Have you ever played with any interesting sensors?
- MEMS sensor with AI programmable core (ISPU - intelligent sensor processing unit)
- Application of Finite State Machine in Embedded Software
- I'm begging for a solution for medical ultrasonic atomizer!!!
- How to set the parameters of RC snubber circuit of mosfet switch tube in boost circuit
- Why is there a small series resistor on the digital signal line? (DC2222A LTC2500)
- Why is there a 50mV difference between the two input terminals of an op amp working in negative feedback?
- Award-winning live broadcast: Bluetooth 5.0, Thread, Zigbee, TI 15.4-Stack, multi-protocol management, all explained to you at once
- Programming implementation of volume control for media applications based on touchpad (Hot Wheels)