大型设备上的232通讯问题

iorihu   2007-3-26 15:47 楼主
实验室的一台大型设备(价值近一千万RMB),有一个RS—232接口,用于和计算机通讯,仪器说明上说仪器是作为一个DTE,请问是否需要将连线(自备的),跳线?
原文说明如下:

9 COMPUTER INTERFACE
9.1 GENERAL
The various computer interfaces of the Maxtek TM-350/400 Deposition Monitors
permit complete remote control using a personal computer. There are three types
of computer interfaces offered. The TM-350/400 comes standard with an RS-232
serial interface. Both RS-485 and IEEE-488 interfaces are available as options.
9.2 RS-232 SERIAL INTERFACE
The standard RS-232 serial interface of the TM-350/400 allows one monitor to be
connected to any other device with an RS-232 serial interface. The RS-232
interface port is the D9P connector on the rear panel of the monitor. The pin
layout is shown in Figure 2-7 and Table 2-4 lists pin signal assignments, including
a definition of whether the signal is an input or an output of the TM-350/400.
The TM-350/400 acts as DTE, and accordingly the 9-pin connector has ‘plug’
pins. It can be used with a DCE or a DTE host cable connection providing the
sense of the RxD/TxD data lines and the control lines is observed. Pin 2 ‘TxD’
transmits data from the TM-350/400 to the host; pin 3 ‘RxD’ receives data from
the host. Pin 7 ‘CTS’ is a control output signal, and pin 8 ‘RTS’ is a control input
signal.
In this implementation, pin 7 ‘CTS’ means what is says, namely, this is an output
control line, and when the TM-350/400 asserts this control line ‘true’ the host can
transmit to the TM-350/400. On the other hand, pin 8 ‘RTS’ is not quite what it
may seem because this is a signal input to the TM-350/400, and it is intended that
the host should assert this line ‘true’ only when the TM-350/400 is allowed to
transmit data to the host. The TM-350/400 does not generate an RTS ‘request-tosend’
as such for the host PC, so the host should assert pin 8 true whenever the
TM-350/400 is allowed to transmit to the host, without being asked to do so.
The TM-350/400’s RS-232 port is automatically set up to operate with the
following specifications:
9600 Baud, 8 Bit data, No Parity, 1 Stop bit

回复评论 (8)

这些个只描述了接口的标准,像哪根线连啥,相关的波特率,串口的属性信息什么的

没看到是否要自己提供线缆的
点赞  2007-3-26 16:10
两个DTE之间的通讯,有挑好的RS232 连线?
点赞  2007-3-26 16:21
有跳好的交叉线卖。
如果线缆内部是2,3脚相连,7,8脚相连,那么就是交叉线。
如果2--2,3--3,7--7,8--8,则是直通线。
你可以带一个万用表,测量该线缆的两端(两边都应为Female)的连通特性。2,3相连,7,8相连就是你所需要的了。要注意的是,有的线缆根本不接7,8脚,只有2,3,5三个脚,这样的不能用。
另外,在你的PC写驱动的时候,应该忽略RTS的信号状态,只要CTS信号(PC端8脚)有效,就开始传送。
点赞  2007-3-26 17:28
楼上的可能没看完我的资料,仪器是作为一个DTE工作的,而且自己不能产生RTS信号,如果使用全握手连接,有没有可能呢?
点赞  2007-3-26 20:38
如果我没有理解错的话,你的设备是这样工作的:
   你的设备在准备好接受数据以后,会把7脚(CTS,应连到PC串口8脚)置位,表示PC可以传数据到设备;因此当PC在8脚(CTS)上检测到信号后,就把7脚置位,然后开始发送数据(不需要请求,The TM-350/400 does not generate an RTS ‘request-tosend’
as such for the host PC, so the host should assert pin 8 true whenever the
TM-350/400 is allowed to transmit to the host, without being asked to do so.
)。
   至于PC接收设备数据方面,因为PC串口是全双工,所以没有问题。
点赞  2007-3-26 22:10
已经按照厂家的要求做了一根线,可以用comtool和仪器通讯了,可是用VB编了一个简单的通讯也不行,源码如下:
Private Sub Command1_Click()
Dim out As String
MSComm1.PortOpen = True
MSComm1.InputLen = 1
out = Chr(&HFF) + (&HFE) + Chr(&H1) + Chr(&H1) + Chr(&H0) + Chr(&HFE) 'To instruct the monitor to send the hardware configuration data
MSComm1.Output = out

End Sub

Private Sub Command2_Click()
Dim a(52) As String
a(51) = Chr(&H2E)
Dim i As Integer
For i = 0 To 50
a(i) = MSComm1.Input
a(51) = a(51) + a(i) 'to receive the  hardware configuration data
Next i
Text1.Text = a(51)
End Sub

Private Sub Command3_Click()
MSComm1.PortOpen = False

End Sub
就是给仪器发个命令,让它把仪器的硬件参数发回来,都是字符串的形式。
现在怀疑是MScomm控件的问题?
哪位能用API实现上面代码的功能(VB下),请发个源码上来,不胜感谢
点赞  2007-3-28 12:42
为什么不怀疑是自己的程序问题呢?呵呵。
找个Mscomm控件的说明,自己看上最多一下午就搞定了。
你的程序:
  第一,没有看到设置波特率的设置(当然,可能你手工配置了);
  第二,你的设备发出的CTS信号,收到该信号,PC才可以发数据,但没见你用到。这样程序可能有时候能用有时候不能用;
  第三,你的设备在接收命令的时候,也许需要一个结束符(ASCII 0x00一类,这是最可能的原因)。
  
我可以保证的是,Mscomm可以达到你的要求,而且会比API使用起来更简单点。
点赞  2007-3-28 14:41
问题已解决了,谢谢ningxin(资深民工) 和其他网友的支持
点赞  2007-3-31 20:44
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复