Application of MCS-51 Single Chip Microcomputer and Wireless Modulator

Publisher:Blissful444Latest update time:2011-07-21 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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 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.

Reference address:Application of MCS-51 Single Chip Microcomputer and Wireless Modulator

Previous article:The use of variables in Keil C51
Next article:Application of AT89C51 single chip microcomputer in cutting force measurement of CNC lathe

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号