+-----[configuration]------+ | Filenames and paths | | File transfer protocols | | Serial port setup | | Modem and dialing | | Screen and keyboard | | Save setup as dfl | | Save setup as.. | | Exit | +--------------------------+
回车,就可以看到许多的选项了,如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
+-----------------------------------------------------------------------+ | A - Serial Device : /dev/modem | | B - Lockfile Location : /var/lock | | C - Callin Program : | | D - Callout Program : | | E - Bps/Par/Bits : 115200 8N1 | | F - Hardware Flow Control : Yes | | G - Software Flow Control : No | | | | Change which setting? | +-----------------------------------------------------------------------+ | Screen and keyboard | | Save setup as dfl | | Save setup as.. | | Exit | | Exit from Minicom | +--------------------------+
+-----------------------------------------------------------------------+ | A - Serial Device : /dev/ttyS0 | | B - Lockfile Location : /var/lock | | C - Callin Program : | | D - Callout Program : | | E - Bps/Par/Bits : 115200 8N1 | | F - Hardware Flow Control : No | | G - Software Flow Control : No | | | | Change which setting? | +-----------------------------------------------------------------------+ | Screen and keyboard | | Save setup as dfl | | Save setup as.. | | Exit | | Exit from Minicom | +--------------------------+
回车,搞定。等等!还没保存呢!回到配置界面,我们选择倒数第4个“Save setup as dfl”,回车。
1 2 3 4 5 6 7 8 9 10 11 12 13
+--------------------------+ | | +-----[configura| Configuration saved | | Filenames and | | | File transfer +--------------------------+ | Serial port setup | | Modem and dialing | | Screen and keyboard | | Save setup as dfl | | Save setup as.. | | Exit | | Exit from Minicom | +----------------------------+
# cat /etc/minirc.dfl # Machine-generated file - use "minicom -s" to change parameters. pu port /dev/ttyS0 pu rtscts No
下面是前几天写的程序的测试过程。 minicom接收数据:
1 2 3 4 5 6 7 8 9 10 11 12 13
Welcome to minicom 2.3 OPTIONS: I18n Compiled on Mar 13 2008, 00:58:14. Port /dev/ttyS0 Press CTRL-A Z for help on special keys Are you going to die? Are you going to die? Are you going to die? Are you going to die? Are you going to die? Are you going to die? Are you going to die? Are you going to die?
发送数据:
1 2 3 4 5 6 7 8 9 10 11 12 13
# ./a.out Open the port success! Setup the port OK! writing... write: 22 writing... write: 22 writing... write: 22 writing... write: 22 writing... write: 22 writing... write: 22 writing... write: 22 writing... write: 22 writing... write: 22 writing... write: 22