Python-based serial port debugging method and system
A serial port debugging and serial port technology, which is applied in the field of serial port debugging based on Python, can solve problems such as communication delay, and achieve the effect of avoiding communication delay and solving blockage.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0045] A kind of Python-based serial port debugging method of the present embodiment, such as figure 1 As shown, in this embodiment, a virtual serial port is selected, and attention should be paid when using readline(): a timeout should be specified when opening the serial port, otherwise, if the serial port does not receive a new line, it will wait forever. If there is no timeout, readline will report an exception. The pyserial library in this embodiment can see the identification of the first serial port, write data into the serial port, open the serial port, read num characters, read a line of data, end with / n, if there is no / n, keep reading until blocking, After setting the baud rate, check the status information of the current serial port, judge whether the current serial port is open, judge the currently received data, clear the data in the input buffer, stop the current output and clear the data in the output buffer, and obtain the data sent from other serial ports A...
Embodiment 2
[0047] This embodiment is further optimized on the basis of Embodiment 1. In this embodiment, in serial communication, the baud rate is used to describe the data transmission rate. The so-called baud rate is the number of binary digits transmitted per second, and its unit is bps (bitsper second). It is an important index to measure the speed of serial data. After the baud rate is specified, the input shift register / output shift register is shifted at the specified baud rate under the control of the receiving clock / sending clock. When the system Clock, that is, when the clock frequency that provides the clock for the serial port is 100M, the clock cycle is One clock cycle is counted once, and so on, and the bit rate is set according to the binary position transmitted per second. In this embodiment, the bit rate is selected to be 9800. After setting the baud rate, you also need to set the function and timeout time.
[0048] Other parts of this embodiment are the same as those...
Embodiment 3
[0050]This embodiment is further optimized on the basis of Embodiment 1. In this embodiment, if two serial ports are selected, that is, serial port 1 and serial port 2, after the connection number, serial port 1 can display the sending content of serial port 2, and serial port 2 It can also display the sending content of serial port 1, and continue to close a virtual serial port during the development process of the serial port host computer, and then use the software we are developing to open it. For example, close the serial port 2 here, then use our software to open the serial port 2, and then send data, if the serial port 1 can receive the data, it proves that the program we sent is correct. After the test is over, stop sending and close the serial port to develop a good habit. If both serial port 1 and serial port 2 can achieve data transmission and reception, it means that the entire experimental environment is installed correctly, and you can enter a higher-level experi...
PUM

Abstract
Description
Claims
Application Information

- R&D
- Intellectual Property
- Life Sciences
- Materials
- Tech Scout
- Unparalleled Data Quality
- Higher Quality Content
- 60% Fewer Hallucinations
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2025 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com