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
如果我没有理解错的话,你的设备是这样工作的:
你的设备在准备好接受数据以后,会把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串口是全双工,所以没有问题。
已经按照厂家的要求做了一根线,可以用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下),请发个源码上来,不胜感谢