- 论坛徽章:
- 0
|
读串口的时候需要注意:
Whenever possible, do not loop reading single characters to get a complete string. When I did this, I lost characters, whereas a read for the whole string did not show any errors.
对于Canonical Input:
A line is by default terminated by a NL (ASCII LF), an end of file, or an end of line character. A CR (the DOS/Windows default end-of-line) will not terminate a line with the default settings.
Canonical input processing can also handle the erase, delete word, and reprint characters, translate CR to NL, etc..
默认是同步的,这时,read是阻塞的,until read is satisfied.
Don't forget to give the appropriate serial ports the right permissions (e. g.: chmod a+rw /dev/ttyS1)!
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/77027/showart_1713350.html |
|