SCT1.04, a serial communication debugging tool in Linux
Source: Internet
Author: User
Article Title: SCT1.04, a serial communication debugging tool in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
I. Preface:
Because of my work needs, I often need to develop peripheral communication programs in different operating systems. When I write a serial communication program under unix for a while, it is found that the serial port of unix/linux is combined with many terminal features (for example, some character terminal controllers are automatically processed in TTY mode), which is very different from the windows mode, so it took a lot of time. I think many people are working on development in linux, and some people will encounter the same problems as me. Therefore, I have compiled the sct (serial communication tracer) serial communication debugger, I hope it can help others develop serial communication, and the software is released in GPL mode. I hope its source code will be of reference value to others.
Second software:
Http://www.makeidea.net/freesoft.html#sct
Software Description:
Sct (short for Serial Communication Tracer) is a useful debugging tool for Linux/Unix Serial Communication. The software has a built-in Shell command interpreter, you can directly enter short commands and parameters to control the opening/closing of the serial port and various sending/receiving activities. The following is a brief example of sct 1.04, the content between double quotation marks is the input command
?? "? "Display the list of all commands
?? "Sel/dev/ttyS0" select/dev/ttyS0 as the current port
?? "Stat" displays the device name of the current port, communication parameter settings, ON/OFF status
?? "Open" open the current port
?? "Close" close the current port
?? "Term" enters terminal mode, simulating an ASCII terminal
?? "Setbuf 1 a" uses ASCII characters to set data in the first buffer zone. a total of 10 buffer zones are available.
?? "Setbuf 1 h" sets the data in the first buffer zone in hexadecimal notation. A total of 10 buffer zones are available.
?? "Dispbuf 1" displays the content of the first buffer zone with Hex and ASCII codes
?? "Send 1" sends the content of the 1st buffer from the current port
?? "Recv 2" receives data from the current port and saves it to the 2nd buffer zone
?? "Sendrecv 1 2" sends the content of the 1st buffer from the current port and immediately receives the data and puts it in the 2nd buffer for debugging in the "command-answer" mode of peripherals
?? "Sendrecv 1 1" sends the content of the 1st buffer from the current port, then receives the data immediately and overwrites it to the 1st buffer for debugging in the "command-answer" mode of peripherals
?? "Savebuf log. dat 1" stores the content of the 1st buffer to the data file log. dat.
?? "Loadbuf 1 log. dat" loads the content of the data file log. dat to the 1st buffer zone.
* For windows users, as long as cygwin is installed, you can also run sct (re-compile under cygwin without changing the source code ), in addition, do not forget to set the current port to "com1" or "com2" using the "sel" command (/dev/ttyS0 by default)
Development Plan for version 4 sct1.04 and later
The serial port code in sct will be referenced in another GPL software package vsio, which is short for virtual stream I/O. vsio operates common PC peripherals in stream mode, such as serial port/parallel port/USB. By then, the sct will directly use vsio to operate the I/O port, not only debugging the serial port, but also debugging the parallel port/USB, and so on. The sct will become a real "Serial Communication Debugger ", instead of "Serial debugger ".
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service