In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
According to the basic type, communication can be divided into parallel communication and serial communication. In parallel communication, each bit of the data is transmitted at the same time, which can complete the byte as a unit communication, but the communication line takes up more capital and the cost is high. For example, we used P0 = 0xFE; assign values to the eight IO ports of P0 at a time and stop signal input at the same time, similar to having eight lanes and eight cars coming at the same time, this way is parallel. We habitually say that P0, P1, P2 and P3 are four sets of parallel buses of 51 single-chip microcomputers.
And serial communication, like a lane, can only come by one car at a time, if a 0xFE such a byte of data is to be transmitted, assuming that the low bit is in the front and the high bit is behind, then the sending method is 0-1-1-1-1-1-1-1-1-1-1-1-1-1, and it takes 8 times to send a byte.
STC89C52 has two pins specifically used for UART serial communication, one is P3.0 and the other is P3.1, they also identify other names called RXD and TXD, and the communication interface formed by them is called serial interface, or serial port for short. Use two single-chip computers to stop UART serial communication, the basic demonstration figure is shown in figure 11-1.
Fig. 11-1 UART communication between single-chip computers
In the figure, GND shows the reference place of the piecemeal power supply of the single-chip microcomputer. TXD is the serial sending pin and RXD is the serial receiving pin. To communicate between the two single-chip computers, the initial power reference should be the same, so we have to connect the GND of the two single-chip computers to each other, and then the TXD pin of the single-chip microcomputer 1 is connected to the RXD pin of the single-chip microcomputer 2, that is, this path is the channel sent by the single-chip microcomputer 1 and accepted by the single-chip microcomputer 2, and the RXD pin of the single-chip microcomputer 1 is connected to the TXD pin of the single-chip microcomputer 2, that is, the channel sent by the single-chip microcomputer 2 and accepted by the single-chip microcomputer 1. This representation diagram shows the process of sending and receiving messages to and from each other.
When single-chip microcomputer 1 wants to send data to single-chip microcomputer 2, such as sending a 0xE4, it is represented as 0b11100100 in a binary way. In the process of UART communication, it is the criterion of low order first, high bit later, then let TXD start to pull down the level, continue for a period of time, send a bit 0, then continue to pull down, continue for a period of time, send another bit 0, then pull up the level, and continue for a period of time. A bit 1 has been sent to the end of sending all the 8-bit binary 0b11100100. One achievement has been touched here, that is, how long has this "period of time" been going on? This introduces a major concept in communication-baud rate, also known as bit rate.
The baud rate is the speed at which binary data bits are sent, which is habitually expressed in baud, that is, the continuation time we send a bit of binary data = 1/baud. Before the communication, single-chip microcomputer 1 and single-chip microcomputer 2 to clearly agree on the communication baud rate between them, must adhere to differences, the sender and sender can normally complete the communication, which everyone must remember clearly.
After we have agreed on the speed, we have to think about the second achievement. When will the data start and when will it be finished?
Whether it is early or delayed, there will be problems with data acceptance. In UART communication, a byte is 8 bits, the rule is that when no communication signal occurs, the communication line insists on high level. Before sending data, send a bit 0 to represent the end bit, then send 8 bits, the data bit is in the order of low then high, and then send a bit 1 to stop bit. In this way, we were supposed to send a byte of 8-bit data, but in practice, we sent a total of 10 bits, one of the extra two bits, a start bit and a stop bit. As for the receiver, once a low level is detected, the receiver will know that it is necessary to prepare for the acceptance of data, accept the 8-bit data bit, then detect the midpoint, and then prepare for the acceptance of the next data. Let's take a look at the diagram, as shown in figure 11-2.
Figure 11-2 Serial port data transmission diagram
Figure 11-2 serial port data transmission representation diagram, in practice, is a time domain representation diagram, that is, the corresponding relationship of signal changes with time. For example, on the sending pin of a single-chip microcomputer, the right one is the first attack, and the left one is the later attack, and the switching time of the data bits is one-second of the baud rate. If you can understand the concept of the time domain, the timing diagrams of many subsequent communications can be easily understood.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.