Remote Communication between PC and MCU Using MSM7512B

Publisher:RadiantExplorerLatest update time:2014-02-17 Source: elecfansKeywords:MSM7512B Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  MSM7512B is a single-chip FSK modem. It complies with the ITUT V.23 standard and can support two data transmission modes: 1200 b/s half-duplex or 1 200 b/s receive/75 b/s transmit full-duplex. MSM7512B is convenient for control or one-way data communication. Such systems are often composed of a small microcontroller at the execution end and a computer at the processing and control end. Such as remote meter reading, remote alarm, remote detection and remote in-system programming through the network. However, if remote two-way data communication through an analog access network is required, the problem is not simple. This leads to the question of how to use MSM7512B for remote communication between PC and microcontroller.

  1 Communication scheme and mode

  The communication scheme should be determined by the specific application. When the PC and the MCU communicate through the public telephone exchange network, since the MSM7512B has no additional functional circuits, a dialing circuit needs to be added to the initiating connection end and a ring detection circuit needs to be added to the answering connection end. If the connection request is initiated by the computer, the communication scheme can be shown in Figure 1.

  Figure 1 Communication block diagram

  Figure 1 Communication block diagram

  The MOD1 and MOD2 pins 14 and 15 of MSM7512B are used to control the communication working mode. When MOD2=0 and MOD1=0, the chip is in the sending mode and can only send data at 1200 b/s; when MOD2=0 and MOD1=1, it is in the receiving mode and can receive data at 1200 b/s or send data at 75 b/s. Unfortunately, there is no mode for MSM7512B to receive data at 75 b/s, so when both the PC and the microcontroller use MSM7512B, full-duplex sending and receiving data is not possible.

  However, the data transmission between the computer and the microcontroller is bidirectional. If there is no response confirmation, the communication process will be difficult to continue. This leads to the question of how to use two MSM7512Bs to achieve bidirectional communication at the link layer in half-duplex mode at the physical layer. In other words, one party uses MOD2=0, MOD1=0, and the other party uses MOD2=0, MOD1=1, and these two modes need to be continuously switched during the communication process.

  2 Issues that must be paid attention to during mode conversion

  According to the design scheme proposed above, it is found that the simplex mode in both directions is feasible through one-way communication test. But this does not mean that half-duplex communication is necessarily feasible. When the modem mode is changed during the communication process after the connection is established, thereby changing the direction of sending and receiving, the received data will be sometimes correct and sometimes incorrect. Obviously, changing the mode during the communication process is an issue worth exploring. After repeated tests and analysis, it was found that when the MSM7512B of both machines are in the receiving state, that is, when neither of them sends data, one party can actually receive some strange data. This means that if one party has switched from the sending mode to the receiving mode and the other party has not had time to switch, the two communicating parties will be in the receiving state at the same time (see Figure 2), and at this time the signal on the analog channel is zero, and the noise on it is mistakenly regarded as a signal by the MSM7512B and received, resulting in the generation of some interference data and affecting normal communication. [page]

  Figure 2 General communication sequence

  Figure 2 General communication sequence

  For this reason, a new communication sequence needs to be formulated to ensure that both parties cannot be in the receiving state at the same time during the communication process, that is, both parties are either in the sending state, or one sends and the other receives. Figure 3 shows the situation in this new communication sequence where the PC sends data and the MCU sends a response. Among them, Td is the data transmission delay, Tc is the MSM7512B mode conversion delay, and T1 and T2 are artificial delays set to avoid both parties being in the receiving state at the same time. The MCU saves data only after receiving the correct frame, and does not operate when waiting to receive the retransmitted frame, and the required time is Tsave. Similarly, the PC loads data when sending a new frame, and does not need to operate when retransmitting the frame, and the required time is Tload.

  Figure 3: Send and receive

  Figure 3: Send and receive

  Under normal transmission and reception conditions (no retransmission), for the MCU, once it receives data from the computer, it immediately changes to the transmission mode, but after changing to the transmission mode, it does not immediately send a response, but waits for the computer to be ready to receive the response after a delay of T1. The MCU cannot immediately switch to the receiving mode after sending the response, but should delay T2 time to ensure that the computer has transferred to the transmission mode before that. If it is a confirmation response, save the data and then switch to the receiving mode. If it is a negative response, directly switch to the receiving mode. For the computer side, the state transfer process is similar. That is, the computer immediately changes to the transmission mode after receiving the response from the MCU. If it is a confirmation response, load the next set of data, and then delay T1 time to wait for the MCU to be ready to receive the data before sending the data. If it is a negative response, directly delay T1 time to wait for the MCU to be ready to receive the state, and then resend the data. The computer cannot immediately switch to the receiving mode after sending the data, but should delay T2 time to ensure that the MCU has transferred to the transmission response mode before that. Obviously, in the case of symmetric links, assuming that the time to load data and save data is the same, T1>T2 should be true.

  So how do we determine T1 and T2? In order to ensure that both parties cannot be in the receiving state at the same time during the communication process (that is, both parties are either in the sending state, or one is sending and the other is receiving), it is not difficult to derive the following relationship:

  

  Because both Tsave and Tload are related to the specific frame length, that is, the machine rate. For example, the microcontroller processes data slower than the PC. Therefore, the longer the frame, the longer the data saving time is. The longer the data loading time, to ensure the correct mode conversion, T1 increases accordingly. Therefore, the delay value, that is, the value of T1 and T2, also depends on the specific data length when the data transmission rate is constant. Through experiments, it is found that when the frame length is 54 bytes, the values ​​of T1 and T2 are 100 ms and 50 ms, which are more reasonable. When the frame length is 100 bytes, the values ​​of T1 and T2 are 200 ms and 100 ms, which are more reasonable. For other lengths of T1 and T2, the trial and error method can be used to test multiple groups of data to compare and select the better one. The principle of selection is to select a smaller value under the premise of ensuring that data transmission can proceed normally.

  3 Transmission efficiency

  The following relationship can be seen from the timing diagram of Figure 3:

  Assume that the frame length is N1 bytes, the response length is N2 bytes, and the data transmission rate is Rb/s. When there are 10 code elements per byte, the total time required to transmit a piece of data is Ts.

  Ts≈2T1+2Tc+2Td+[(N1+N2)×10/R]×1 000 (ms)?(3)

  Among them, Td is related to the path length and the medium, and Tc is related to the modulation and demodulation chip, and they are generally small. Since the transmission efficiency is inversely proportional to the transmission time, when N1, N2, and R are constant, formula (3) shows that the transmission efficiency is mainly determined by T1, that is, the smaller T1 is, the higher the transmission efficiency. Note that the delay T2 is to ensure that the sender is still in the sending mode before the receiver changes to the sending mode during the communication process, and also to ensure that it changes to the receiving mode before the other party sends the data. Its selection only needs to satisfy the relationship (1). On the surface, it has nothing to do with the transmission efficiency, but because T1 is restricted by T2, it implies the requirement for T2. It can be seen that the reasonable selection of the artificial delay time T1 and T2 for mode conversion is the key to improving transmission efficiency.

  Using the above solution, the MSM7512B can be used to correctly send and receive remote data between the PC and the microcontroller.

Keywords:MSM7512B Reference address:Remote Communication between PC and MCU Using MSM7512B

Previous article:Describe how to achieve communication between microcontroller and touch screen
Next article:Motor and PFC control based on 8-bit microcontroller

Recommended ReadingLatest update time:2024-11-16 22:25

Programmable Active Filter Circuit Based on Single Chip Microcomputer Control
Active filters are widely used in digital signal processing, communication, and automatic control, but it is difficult to design variable broadband active filters. Using a single-chip microcomputer to control programmable dual-second-order universal switched capacitor active filter, the center frequency f0, quality
[Microcontroller]
Programmable Active Filter Circuit Based on Single Chip Microcomputer Control
Design of VCN-MIO Intelligent Node Template Circuit Based on AT89C2051 Single Chip Microcomputer
  0 Preface   Based on the intelligent node template of Neuron chip with three CPUs and solidified LonTalk communication protocol, since Neuron chip is an eight-bit processor, and only provides 11 general I/O ports, and adopts a software scheduling mechanism based on event inspection, its control function is relativel
[Microcontroller]
Design of VCN-MIO Intelligent Node Template Circuit Based on AT89C2051 Single Chip Microcomputer
Design of infrared remote control decoding program based on 51 single chip microcomputer
describe The following is a decoding program for the infrared remote control that comes with the 51 experiment board. It can read out the key value of each button on the infrared remote control and display it through the 8 LEDs of the P1 port on the experiment board. When the decoding is successful, it can also emit
[Microcontroller]
Design of infrared remote control decoding program based on 51 single chip microcomputer
Research on the Software Instruction System of Single Chip Microcomputer
After the single-chip microcomputer has hardware, it must have software to truly perform calculations and control. Software mainly refers to various programs. Only when various correct programs are "injected" (stored) into the single-chip microcomputer (http://www.cy8cjiemi.com) can it work effectively. The reason why
[Microcontroller]
[Self-study 51 single chip microcomputer] 12 --- Preliminary understanding of 1602 LCD
1. Introduction to 1602 LCD hardware interface 1602 LCD technical parameters Note: (1) Working current: The working current of the LCD is 2mA at a working voltage of 5V, which only refers to the LCD and does not include the backlight. 1602 LCD interface schematic and pin functions Description: (1) Pin 3: LCD
[Microcontroller]
[Self-study 51 single chip microcomputer] 12 --- Preliminary understanding of 1602 LCD
Application of AT89C51 microcontroller in wireless data transmission
A general digital acquisition system is The captured on-site signals are converted into electrical signals through sensors. After sampling, quantization and encoding by the analog/digital converter ADC, they are converted into digital signals and stored in the data memory , or sent to the microprocessor, or wirelessly
[Microcontroller]
High-precision frequency regulator based on AVR microcontroller
1. Introduction In modern industrial production and high-precision testing, we need quite precise frequencies to help judge equipment performance indicators. And we want to be able to fine-tune that frequency. The frequency obtained by using a voltage-controlled oscillator is not accurate enough, and the steps to fin
[Microcontroller]
4×4 keyboard C51 MCU program source code sharing
/*MCU:AT89S52*/ #include  #include  #define uchar unsigned char int key; int of; void Key_Scan(void); /************Main program*************/ void main(void) {  void Key_Scan(void); void delay(int); while(1) {    Key_Scan();     delay(2000); } } /********Matrix key search key value 4*4 procedure******/ void Key_Scan(v
[Microcontroller]
4×4 keyboard C51 MCU program source code sharing
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号