连线定义
串行直连电缆用于两台计算机的直接相连,电缆两端的插头一头是
9 针母插头,另一头是 25 针母插头:

上两图均为母头俯视图
9针母头管脚定义:
| 管脚号 |
管脚中英文名 |
| 1 |
Data Carrier Detect
数据载波检测 |
| 2 |
Receive Data
接收数据 |
| 3 |
Transmit Data
发送数据 |
| 4 |
Data Terminal Ready
数据终端就绪 |
| 5 |
System Ground
信号地 |
| 6 |
Data Set Ready
数据设备就绪 |
| 7 |
Request to Send
请求发送 |
| 8 |
Clear to Send
清除发送 |
25针母头管脚定义(其中在该连接中,只有8根针起作用):
| 管脚号 |
管脚中英文名 |
| 2 |
Transmit Data
发送数据 |
| 3 |
Receive Data
接收数据 |
| 4 |
Request to Send
请求发送 |
| 5 |
Clear to Send
清除发送 |
| 6 |
Data Set Ready
数据设备就绪 |
| 7 |
System Ground
信号地 |
| 8 |
Data Carrier Detect
数据载波检测 |
| 20 |
Data Terminal Ready
数据终端就绪 |
引脚定义
当连接一头为9针母插头而一头为25针时母插头时,线路连接应该为:
|
D-Sub 9 |
D-Sub 25 |
|
| Data Carrier Detect |
1 |
4+5 |
Request to Send+Clear
to Send |
| Receive Data |
2 |
2 |
Transmit Data |
| Transmit Data |
3 |
3 |
Receive Data |
| Data Terminal Ready |
4 |
6 |
Data Set Ready |
| System Ground |
5 |
7 |
System Ground |
| Request to Send+Clear
to Send |
7+8 |
8 |
Data Carrier Detect |
| Data Set Ready |
6 |
20 |
Data Terminal Ready |
| RI |
9 |
9 |
RI |

当连接两头均为9针母插头时,线路连接应该为:
|
D-Sub 9 |
D-Sub 9 |
|
| Carrier Detect |
1 |
7+8 |
Request to Send+Clear
to Send |
| Receive Data |
2 |
3 |
Transmit Data |
| Transmit Data |
3 |
2 |
Receive Data |
| Data Terminal Ready |
4 |
6 |
Data Set Ready |
| System Ground |
5 |
5 |
System Ground |
| Data Set Ready |
6 |
4 |
Data Terminal Ready |
| Request to Send+Clear
to Send |
7+8 |
1 |
Carrier Detect |
| RI |
9 |
9 |
RI |

备注:NC表示另外一头对应的针脚自己连接
另外为了保证串口物理上可以正常工作,可以通过使用制作堵头来测试该口是否正常:

将堵头插入到要测试的串口上,然后按照下面的netterm设置,连接以后,在netterm输入字符,若屏幕上显示了输入的字符,则说明该串口物理正常。
软件配置说明
一、NETTERM设置说明:
Emulation(模拟型态): ANSI
Connection(连接型态):Modem(调制解调器)
Keys(键盘定义):Default
其中 调制解调器设置参数为:
port(端口):COM1(或COM2 取决于连接线连接在哪个端口上)
Baud Rate(波特率):9600
Data Bits(资料位):8
Parity(奇偶):None(无)
Stop Bits(停止位):1
Maxium Connect(拨接时最长等待时间):60
控制部分设置中:只有 Direct Line使能(也就是在check box中打上对号,其他的都不选)
其他参数保持缺省不要修改
二、linux环境下Mgetty设置说明:
首先需要安装Mgetty软件包,在Redhat的光盘中有该软件的RPM包只需要在该RPM包所在目录下运行:
rpm -ivh mgetty-1.1.3-i386.rpm
即可
其中需要修改的设置为:
在/etc/目录下的 inittab 配置文件最后加如一行如下:
S0:345:respawn:/sbin/mgetty -r -x 9 ttyS1
其中最后一个参数ttyS1应该根据你连接的linux机器哪个端口来决定,若连接到com1则应该将该参数修改为ttyS0
若为COM2则应该为ttyS1
另外在/etc/mgetty-sendfax目录下有mgetty.config文件:
内容应该为:
#
# mgetty configuration file
#
# this is a sample configuration file, see mgetty.info for details
#
# comment lines start with a "#", empty lines are ignored
# ----- global section -----
#
# In this section, you put the global defaults, per-port stuff is below
# set the global debug level to "4" (default from policy.h)
debug 9
# access the modem(s) with 38400 bps
speed 9600
port ttyS1
direct yes
其中若你连接到inux机器的com1口的话,则需要将
port ttyS1
修改为
port ttyS0
其他保持不变
注:其中mgetty程序的log文件为/var/log/目录下的mget*文件,可以查看该文件来判断问题所在
(http://www.fanqiang.com)
进入【