Question 2: What is a serial communication protocol? A serial communication protocol refers to an agreement between two parties. The agreement includes uniform provisions on data format, synchronization mode, transmission speed, transmission steps, error detection and correction mode, and definition of control characters, which both parties must abide by. So it is also called communication control procedure, or transmission control procedure, which belongs to the data link layer in the seven-layer reference model of OSI of ISO.
Question 3: How to write the serial communication protocol can be defined by yourself, but the requirements are different. You can define it at will, according to the customer's requirements, or according to the definition of relevant equipment (as you said, if your host scans the QR code with a scanner, there should be relevant coding protocols inside the host), and you can find it by reading the relevant instructions. At the same time, you can also add a check code to it and so on.
Question What are the 232 or 485 serial communication protocols of plc?
Question 5: Should the serial communication protocol be hardware or software? The serial data stream is native and has no compiled data.
Through software, it is recognized as a signal to complete the required function execution.
Question: What does R232 serial communication protocol mean? What is the content? What's the difference between it and R485? The difference is that 232 is full duplex.
One is half duplex.
Question 7: Asynchronous communication protocol of serial communication 1 and data format asynchronous data communication in serial asynchronous communication, also known as start-stop asynchronous communication, are the most commonly used data information transmission methods in computer communication. It is transmitted in character units, and there is no fixed time interval between characters, but every bit in each character is transmitted at a fixed time. The synchronization method between the receiver and the sender is to set the start bit and stop bit in character format. Before sending a valid character, the sender sends a start bit, then the valid character bit, and then sends a stop bit at the end of the character, and the start bit to the stop bit form a frame. Data format in serial asynchronous transmission: ⑴ Start bit: The start bit must be a logical "0" level that lasts for one bit, marking the beginning of a character transmission. ⑵ Data bits: The data bits are 5-8 bits, immediately after the start bit, and are the effective data bits of the transmitted characters. When transmitting, low-order characters are transmitted first, and then high-order characters are transmitted. The number of data bits can be set by hardware or software. ⑶ Parity check bit: Parity check bit only occupies one bit and is used for parity check, or there is no parity check bit. ⑶ Stop bit: Stop bit is 1 bit, 1.5 bit or 2 bit, which can be set by software. Must be logical "1" level, marking the end of transmission of a character. 5. Idle bit: Idle bit indicates that the line is idle, and the logic level on the line is "1". There can be no idle bits, and the efficiency of asynchronous transmission is the highest. 2. Data reception in serial asynchronous communication When receiving serial asynchronous communication, the receiver constantly detects or monitors the level change on the serial input line. When it detects the occurrence of the valid start bit, it knows that the valid character bit will appear later and starts to receive valid characters. When it detects the stop bit, it knows that the transmitted character has ended. After a random time interval, the next character is transmitted. Generally, the sampling clock period of the receiver is shorter than the bit period of the transmitted character, and the common sampling clock frequency is 16 times of the bit frequency. This measure is taken to improve the anti-interference ability, as shown in Figure 8. 19. As can be seen from the figure, the bit period Td of the transmitted character is equal to 16 times of the sampling clock period Tc. The receiver samples the input signal at every rising edge of the sampling clock, and checks whether the low level on the receiving data line has been maintained for 8 or 9 consecutive clock cycles to determine whether the low level on the transmission line is the real start bit. In this way, the misoperation caused by noise interference can be avoided and the misoperation bit can be deleted. The midpoint of the start bit is determined quite accurately, thus providing a time reference. On this basis, the remaining data bits are sampled every 16 Tc to ensure the correctness of the transmitted data. In order to realize the benchmark of sampling data, the receiver can perform the following steps: (1) Set a sampling clock frequency counter at the receiver, clear it when the falling edge of the start bit is detected, and start counting the sampling clocks, that is, add 1 to the counter for each clock. (2) When the counter reaches 8, it means that it has reached the middle position of the starting bit. At this time, the sampling value is 0, indicating that it is a real start bit, and the counter is reset; If the sampling value is not 0, it means that the falling edge detected at the beginning is not the real rising edge of the start bit, but an interference. The test should be invalid, the counter should be cleared, and the start bit test should be restarted. (3) After the real start bit is detected, the counter is cleared. Every time it reaches 16, the received signal waveform (that is, the middle of each bit) is sampled, and the collected value is temporarily stored. At the same time, the counter is cleared and counted again until the last stop bit is sampled. (4) If the stop bit is correctly sampled (1), the character is received by the register and loaded into the register. If the sampling value of the stop bit is 0, it means that there is a problem with synchronization or transmission, and the characters obtained by this sampling are invalid and will not be received. The characteristics of asynchronous communication (1) The start-stop asynchronous communication protocol does not require high clock synchronization between the sender and the receiver. Even if the clock frequencies of the receiver and the transmitter are different, as long as the sampling of the receiver after the start bit of a character is not misplaced, the data transmission can still be carried out normally. Therefore, the sender and receiver of asynchronous communication do not need to use the same clock, and both parties can use their own local clocks. ⑵ In practical application, the data format of serial asynchronous communication, including the number of data bits, the setting of parity bits and the number of stop bits, can be set by software commands through the programmable serial interface circuit according to actual needs. In different transmission systems, these links >:>
Question 8: Handshake RS-232 communication mode of serial communication protocol allows simple connection of Tx, Rx and ground wires. But for data transmission, both parties must use the same baud rate for data timing. Although this method is sufficient for most applications, its use is limited when the receiver is overloaded. At this time, the handshake function of serial port is needed. In this section, we will discuss the three most commonly used forms of RS-232 handshake: software handshake, hardware handshake and Xmodem. A. Software handshake: The first handshake we discussed was software handshake. It is usually used when the actual data is control characters, similar to the way GPIB uses command strings. There are still three necessary lines: Tx, Rx and ground. Because there is no difference between control characters and ordinary characters on the transmission line, the function SetXModem allows users to use or prohibit users from using two control characters XON and XOFF. These characters are sent by the receiver in communication, making the sender pause. For example, suppose the sender sends data at a high baud rate. During transmission, the receiver found that the input buffer was full because the CPU was busy with other work. In order to temporarily stop transmission, the receiver sends XOFF, with a typical value of decimal 19, that is, hexadecimal 13, until the input buffer is empty. Once the receiver is ready to receive, it sends XON, with a typical value of 17 in decimal, that is, 1 1 in hexadecimal, to continue the communication. When the input buffer is half full, LabWindows sends XOFF. In addition, if the XOFF transmission is interrupted, LabWindows will send XOFF when the buffer reaches 75% and 90%. Obviously, the sender must follow this code to ensure that the transmission continues. B, hardware handshake: the second is to use hardware lines to shake hands. Like Tx and Rx lines, RTS/CTS and DTR/DSR work together, with one as the output and the other as the input. The first set of lines are RTS (request to send) and CTS (clear to send). When the receiver is ready to receive data, it will set the RTS line high to indicate that it is ready. If the sender is ready, it will set CTS to high level, indicating that it is about to send data. The other set of wires are DTR (data terminal ready) and DSR (data set ready). These lines are mainly used for modem communication. Let the serial port and modem communicate their status. For example, when the modem is ready to receive data from a PC, it sets the DTR line to a high level, indicating that the connection with the telephone line has been established. Read the DSR line and set it to high level, and the PC starts to send data. A simple rule is that DTR/DSR is used to indicate the communication readiness of the system, while RTS/CTS is used to transmit a single packet. In LabWindows, the function SetCTSMode enables or disables hardware handshaking. If CTS mode is enabled, LabWindows uses the following rules: When PC sends data, RS-232 library must detect the height of CTS line before sending data. When PC receives data: If the port is open, the input queue can receive data freely, and the library function sets RTS and DTR to high. If the input queue is 90% full, the library function sets RTS to low, but keeps DTR high. If the port queue is almost empty, the library function sets RTS to high, but keeps DTR high. If the port is closed, the library function sets RTS and DTR to low. C, XModem handshake: the handshake discussed at last is called XModem file transfer protocol. This protocol is very common in modern communication. Although XModem protocol is usually used for modem communication, it can also be directly used for other devices that follow this protocol. In LabWindows, the actual XModem application is hidden from users. As long as devices such as PC use XModem protocol, file transfer uses XModem function of LabWindows. These functions are XModemConfig, XModemSend and XModemReceive. XModem uses protocols with the following parameters: start_of_data, end_of_data, neg_ack, wait_delay, start_delay, max_tries and packet_size. These parameters need to be confirmed by both communication parties, and the standard XModem has a standard definition ... >; & gt
Question 9: How to design a serial communication protocol? Simply put, to make a protocol, you must first consider your bus topology. Whether it is point-to-point transmission (whether it is a master and a slave, or two peer nodes), or a host hangs multiple slave nodes (how nodes and hosts are linked, whether it is star link, tree link or bus connection).
If it is a point-to-point with one master and one slave, it is the simplest. If it is two peer nodes or one-to-many bus nodes, we should consider bus competition, conflict, address design, timeout processing and other issues.
The simplest point-to-point situation (closed network, that is, the number of equipment nodes is determined, and the non-phase equipment protocols are different, so it is impossible to access the network).
First of all, your baud rate setting, it is best to set a baud rate for all nodes. Someone has done communication at different baud rates, but I haven't played it. Moreover, the baud rate depends on the data overhead of your bus, the speed of the processor/controller, the electromagnetic complexity in the application environment, and the bandwidth of the hardware device (will it be affected if the frequency is high, will it increase the packet loss rate or affect other devices).
Then a frame should have a frame identifier at the beginning, so that the other party can judge whether it is a data frame or a reply frame. Point-to-point communication should have at least one data command frame and one response frame. The data command frame contains the main configuration information, and the response frame tells the other party whether the data is correct. If not, please resend. In addition, if the received frame identification is not these two kinds, it means that there may be bus problems/interference/access to other unknown devices.
Secondly, consider how much data you transmit and whether you need to fix the length of the data packet. If the transmitted data is sometimes more (ten/dozens of bytes) and sometimes less (less than one byte), then the length cannot be fixed. In this case, it is necessary to add the length information of the packet/frame in the second and third bytes (before and after the byte identified by the frame).
Then the address. Although there are only two points for face-to-face communication, it is recommended to add a source address and a destination address. This is just a suggestion, which is optional in point-to-point communication.
After that, add a serial number to indicate how many times it was sent. For example, I sent you a hello once, and I should send you a world next time, but your feedback response frame said that I didn't receive it or received an error, and then I sent you a hello again. At this point, the sequence number in the Hello frame should be 2.
Next is the data content. ...
Finally, check CRC ... XOR operation ... and so on. , check all the bits in the previous data from the beginning to the end of the frame. Prevent any bit errors during transmission.
That's all I can think of now. I remember when a group of us reached an agreement on railway signal equipment. After reading the protocol we came up with two weeks ago (based on RS584), the people in the institute said: Is the protocol that simple? I didn't dare to say a safe and firm agreement until I tried it for a year.
Question 10: What is the difference between data frame format and communication protocol in serial communication? Serial parameters refer to the corresponding parameters that need to be set in serial communication, just like when a mobile phone accesses the Internet, whether it uses an electric signal or a mobile number, 3G network or 2G network? Although it is automatically set by the mobile phone, it still needs you to set it.
A communication protocol is what language you speak. When communicating with others, everyone speaks Mandarin. One speaks English and the other speaks French, which is definitely not good.
485-can-tcp/ ... new testament (abbreviation of New Testament)