VB6基于Windows API的Modbus RTU/ASCII/TCP的主站实现代码

笨狗先飞 2016-01-12 12:38:26
应该还是发论坛上人气多一些

程序分了三个模块,实现的是Modbus主站的操作,
modSerialPort.bas 串口操作模块
modTCPClient.bas TCP操作模块
modModbusMaster.bas Modbus主站模块
串口操作模块和TCP操作模块也可以单独使用,当作简单的通讯读写操作
这里TCP协议有个问题,当对应主机不存在的时候,连接时间很长,我不知道怎么处理这个连接超时的问题,希望可以指点一下.
实现代码例举如下

'打开
hModbus=ModbusOpen("Com1",ModbusRTU) '或者
hModbus=ModbusOpen("192.168.1.2:502",ModbusTCP)
'读取
if ModbusRead(hModbus,1,InputStatus,0,IntArr,ModbusRTU)=True then
'读取成功
else
'读取失败
end

'写入
if ModbusWrite(hModbus,1,HoldingRegister,0,IntArr,ModbusRTU)=True then
'写入成功
else
'写入失败
end

'关闭
ModbusClose(hModbus,ModbusRTU)

'说明:IntArr是一个整形数组,也可以是一个长整形数组,有符号和无符号的区别,浮点的什么的还是要自己去外部处理,这里还是以寄存器为单位的
...全文
1766 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
hellloTT 2017-07-31
  • 打赏
  • 举报
回复
VB6的完整代码不多,非常感谢!学习的好参照!
笨狗先飞 2016-04-03
  • 打赏
  • 举报
回复
引用 8 楼 XiZhuXiVB 的回复:
请问大神,这个支持 MODBUS RTU 的协议么? 3个代码模块仔细看了,代码写得很规范,但是不知道该怎么结合窗体调用来和设备通信,能不能帮忙做个实例呢?
都是函数,所以直接可以放在代码里,例子可以参看楼顶
XiZhuXiVB 2016-04-02
  • 打赏
  • 举报
回复
请问大神,这个支持 MODBUS RTU 的协议么? 3个代码模块仔细看了,代码写得很规范,但是不知道该怎么结合窗体调用来和设备通信,能不能帮忙做个实例呢?
一笑拔剑 2016-01-13
  • 打赏
  • 举报
回复
啥用的? 先接点分
imwwb 2016-01-12
  • 打赏
  • 举报
回复
modModbusMaster.bas 第二部分 ,马夹补一下 ===================================

Public Function ModbusRead(ByVal Handle As Long, ByVal ID As Byte, ByVal RegType As ModbusRegistersType, ByVal Address As Long, ByRef Registers As Variant, Optional ByVal Protocol As ModbusProtocolType = DEFAULT_PROTOCOL, Optional ByVal WaitTime As Integer = DEFAULT_WAIT_TIME, Optional ByVal ReTryCount As Byte = DEFAULT_RETRY_COUNT) As Boolean  
    Dim Result As Boolean, I As Long, Count As Long, Data() As Byte, Arr() As Byte, ArrR() As Byte, TryCount As Integer  
    If Handle = -1 Then Exit Function  
    If IsArray(Registers) Then  
        Count = UBound(Registers) + 1  
    Else  
        Count = 1  
    End If  
    If Count < 1 Then Exit Function  
      
    ReDim Data(5)  
    Data(0) = ID '设备地址  
    Data(1) = RegType '功能码  
    Data(2) = (Address And &HFF00&) \ 256  
    Data(3) = Address Mod 256
    Data(4) = Count \ 256
    Data(5) = Count Mod 256
    TryCount = 1  
    Do Until TryCount > ReTryCount  
        PacketTo Data, Arr, Protocol  
        Select Case Protocol  
            Case ModbusASCII, ModbusRTU  
                ComWriteByte Handle, Arr  
            Case ModbusTCP  
                TCPWriteByte Handle, Arr  
        End Select  
        Erase Arr  
        If ID = 0 Then  
            Erase Data  
            ModbusRead = True  
            Exit Function  
        Else  
            Select Case Protocol  
                Case ModbusASCII, ModbusRTU  
                    ComReadByte Handle, Arr, WaitTime  
                    PacketFrom Arr, ArrR, Protocol  
                Case ModbusTCP  
                    TCPReadByte Handle, Arr, WaitTime  
                    PacketFrom Arr, ArrR, Protocol  
            End Select  
            Erase Arr  
            If Len(StrConv(ArrR, vbUnicode)) > 0 Then Exit Do  
        End If  
        TryCount = TryCount + 1  
    Loop  
    Erase Data  
    If Len(StrConv(ArrR, vbUnicode)) > 0 Then  
        Select Case ArrR(1)  
            Case &H1, &H2 '0x01[读写量] 0x02[只读量]  
                If IsArray(Registers) Then  
                    If ArrR(2) <> IIf(Count Mod 8 = 0, Count \ 8, Count \ 8 + 1) Then  
                        Erase ArrR  
                        Exit Function  
                    End If  
                    For I = 0 To Count - 1  
                        Registers(I) = CByte(IIf((ArrR(I \ 8 + 3) And 2 ^ (I Mod 8)) = 0, 0, 1))  
                    Next  
                Else  
                    If UBound(ArrR) < 3 Then  
                        Erase ArrR  
                        Exit Function  
                    End If  
                    Registers = CByte(ArrR(3))  
                End If  
                Result = True  
            Case &H3, &H4 '0x03[读写寄存器] 0x04[只读寄存器]  
                If IsArray(Registers) Then  
                    If ArrR(2) <> Count * 2 Then  
                        Erase ArrR  
                        Exit Function  
                    End If  
                    For I = 0 To Count - 1  
                        Select Case VarType(Registers(I))  
                            Case vbLong  
                                Registers(I) = CLng("&H" & Hex(ArrR(I * 2 + 3), 2) & Hex(ArrR(I * 2 + 4), 2))  
                            Case vbInteger  
                                Registers(I) = CInt("&H" & Hex(ArrR(I * 2 + 3), 2) & Hex(ArrR(I * 2 + 4), 2))  
                        End Select  
                    Next  
                Else  
                    If UBound(ArrR) < 4 Then  
                        Erase ArrR  
                        Exit Function  
                    End If  
                    Select Case VarType(Registers)  
                        Case vbLong  
                            Registers = CLng("&H" & Hex(ArrR(3), 2) & Hex(ArrR(4), 2))  
                        Case vbInteger  
                            Registers = CInt("&H" & Hex(ArrR(3), 2) & Hex(ArrR(4), 2))  
                    End Select  
                End If  
                Result = True  
            Case Else  
                '  
        End Select  
    End If  
    Erase ArrR  
    ModbusRead = Result  
End Function  
  
Public Function ModbusWrite(ByVal Handle As Long, ByVal ID As Byte, ByVal RegType As ModbusRegistersType, ByVal Address As Long, ByRef Registers As Variant, Optional ByVal SingleWrite As Boolean = False, Optional ByVal Protocol As ModbusProtocolType = DEFAULT_PROTOCOL, Optional ByVal WaitTime As Integer = DEFAULT_WAIT_TIME, Optional ByVal ReTryCount As Byte = DEFAULT_RETRY_COUNT) As Boolean  
    Dim Result As Boolean, I As Long, FunCode As Byte, Count As Long, Data() As Byte, Arr() As Byte, ArrR() As Byte, TryCount As Integer, Value As Long  
    If Handle = -1 Then Exit Function  
    If IsArray(Registers) Then  
        Count = UBound(Registers) + 1  
    Else  
        Count = 1  
    End If  
    Select Case RegType  
        Case CoilStatus ' 1  
            FunCode = IIf((Count = 1) And (SingleWrite = True), &H5, &HF)  
        Case HoldingRegister ' 3  
            FunCode = IIf((Count = 1) And (SingleWrite = True), &H6, &H10)  
        Case Else  
            FunCode = 0  
    End Select  
    If (Count < 1) Or (FunCode = 0) Then Exit Function  
    Result = False  
    Select Case FunCode  
        Case &H5, &H6 '0x05[写单个点]  0x06[写单个寄存器]  
            ReDim Data(5)  
            Data(0) = ID  
            Data(1) = FunCode  
            Data(2) = (Address And &HFF00&) \ 256 '寄存器地址高字节  
            Data(3) = Address Mod 256 '寄存器地址低字节  
            If FunCode = &H5 Then  
                If IsArray(Registers) Then  
                    Value = IIf(Registers(0) = 0, 0&, &HFF00&)  
                Else  
                    Value = IIf(Registers = 0, 0&, &HFF00&)  
                End If  
            Else  
                If IsArray(Registers) Then  
                    Value = CLng("&H" & Hex(Registers(0)))  
                Else  
                    Value = CLng("&H" & Hex(Registers))  
                End If  
            End If  
            Data(4) = Value \ 256  '写入值高字节  
            Data(5) = Value Mod 256 '写入值低字节  
        Case &HF '0x0F 写多个点  
            ReDim Data(6 + IIf(Count Mod 8 = 0, Count \ 8, Count \ 8 + 1))  
            Data(0) = ID  
            Data(1) = FunCode  
            Data(2) = (Address And &HFF00&) \ 256 '寄存器地址高字节  
            Data(3) = Address Mod 256 '寄存器地址低字节  
            Data(4) = Count \ 256  '寄存器数量高字节  
            Data(5) = Count Mod 256
            Data(6) = IIf(Count Mod 8 = 0, Count \ 8, Count \ 8 + 1) 
            If IsArray(Registers) Then  
                For I = 0 To Count - 1  
                    If Registers(I) <> 0 Then Data(7 + I \ 8) = Data(7 + I \ 8) Or 2 ^ (I Mod 8)  
                Next  
            Else  
                Data(7) = IIf(Registers <> 0, 1, 0)  
            End If  
        Case &H10 
            If Count > &H78 Then Exit Function   
            ReDim Data(6 + Count * 2)  
            Data(0) = ID  
            Data(1) = FunCode  
            Data(2) = (Address And &HFF00&) \ 256   
            Data(3) = Address Mod 256   
            Data(4) = Count \ 256   
            Data(5) = Count Mod 256   
            Data(6) = Count * 2 '字节数  
            If IsArray(Registers) Then  
                For I = 0 To Count - 1  
                    Value = CLng("&H" & Hex(Registers(I))) And &HFFFF&  
                    Data(7 + I * 2) = Value \ 256 '高字节  
                    Data(8 + I * 2) = Value Mod 256 '低字节  
                Next  
            Else  
                Value = CLng("&H" & Hex(Registers)) And &HFFFF&  
                Data(7) = Value \ 256  '高字节  
                Data(8) = Value Mod 256  '低字节  
            End If  
        Case Else  
            '  
    End Select  
    If Len(StrConv(Data, vbUnicode)) > 0 Then  
        TryCount = 1  
        Do Until TryCount > ReTryCount  
            PacketTo Data, Arr, Protocol  
            Select Case Protocol  
                Case ModbusASCII, ModbusRTU  
                    ComWriteByte Handle, Arr  
                Case ModbusTCP  
                    TCPWriteByte Handle, Arr  
            End Select  
            Erase Arr  
            If ID = 0 Then
                ModbusWrite = True  
                Exit Function  
            Else  
                Select Case Protocol  
                    Case ModbusASCII, ModbusRTU  
                        ComReadByte Handle, Arr, WaitTime  
                        PacketFrom Arr, ArrR, Protocol  
                    Case ModbusTCP  
                        TCPReadByte Handle, Arr, WaitTime  
                        PacketFrom Arr, ArrR, Protocol  
                End Select  
                Erase Arr  
                If Len(StrConv(ArrR, vbUnicode)) > 0 Then Exit Do  
            End If  
            TryCount = TryCount + 1  
        Loop  
        Erase Data  
        If Len(StrConv(ArrR, vbUnicode)) > 0 Then  
            Result = CBool(FunCode = ArrR(1))  
        End If  
    End If  
    Erase ArrR  
    ModbusWrite = Result  
End Function  
  
'Utils  
Public Function Readbit(ByVal Address As Long, ByRef Registers() As Byte) As Integer  
    Readbit = IIf(Registers(Address \ 8) And CByte(2 ^ (Address Mod 8)), 1, 0)  
End Function  
  
Public Sub Writebit(ByVal Address As Long, ByVal Value As Long, ByRef Registers() As Byte)  
    If Value = 0 Then  
        Registers(Address \ 8) = Registers(Address \ 8) And (Not CByte(2 ^ (Address Mod 8)))  
    Else  
        Registers(Address \ 8) = Registers(Address \ 8) Or CByte(2 ^ (Address Mod 8))  
    End If  
End Sub  
  
Public Function ReadWord(ByVal Address As Long, ByRef Registers() As Byte) As Integer  
    CopyMemory ReadWord, Registers(Address * 2), 2  
End Function  
  
Public Sub WriteWord(ByVal Address As Long, ByVal Value As Integer, ByRef Registers() As Byte)  
    CopyMemory Registers(Address * 2), Value, 2  
End Sub
笨狗先飞 2016-01-12
  • 打赏
  • 举报
回复
完了,这第三个太长写不下了, modModbusMaster.bas 第一部分 =============================================

Option Explicit  
Private Const DEFAULT_QUEUE = 1024  
Private Const DEFAULT_WAIT_TIME = 50  
Private Const DEFAULT_RETRY_COUNT = 3  
Private Const DEFAULT_PROTOCOL = 0  
  
'Modbus  
Public Enum ModbusProtocolType  
    ModbusRTU = 0  
    ModbusASCII = 1  
    ModbusTCP = 2  
End Enum  
  
Public Enum ModbusRegistersType  
    CoilStatus = 1  
    InputStatus = 2  
    HoldingRegister = 3  
    InputRegister = 4  
End Enum  
  
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)  
  
'Modbus  
Private Function ArrToHex(ByRef Arr() As Byte) As String  
    Dim I As Integer, Result As String  
    For I = 0 To UBound(Arr)  
        Result = Result & Hex(Arr(I), 2)  
    Next  
    ArrToHex = Result  
End Function  
  
Private Function Hex(ByVal Number As Variant, Optional ByVal Length As Integer = 0) As String  
    Dim Result As String  
    Result = VBA.Hex(Number)  
    If Len(Result) < Length Then Result = String(Length - Len(Result), "0") & Result  
    Hex = Result  
End Function  
  
Private Sub HexToArr(Str As String, ByRef Result() As Byte)  
    Dim C As Integer, I As Integer, CH As String  
    C = Len(Str) \ 2 - 1  
    ReDim Result(C)  
    For I = 0 To C  
        CH = Mid(Str, I * 2 + 1, 2)  
        Result(I) = CByte("&H" & CH)  
    Next  
End Sub  
  
Private Sub GetCRC16(ByRef Data() As Byte, ByRef Result() As Byte, Optional ByVal offset As Integer = 0, Optional ByVal Length As Integer = 0)  
    Dim CRC16Lo As Byte, CRC16Hi As Byte      'CRC寄存器  
    Dim CL As Byte, CH As Byte                '多项式码&HA001  
    Dim SaveHi As Byte, SaveLo As Byte  
    Dim I As Integer  
    Dim Flag As Integer  
      
    CRC16Lo = &HFF  
    CRC16Hi = &HFF  
    CL = &H1  
    CH = &HA0  
    Length = IIf(Length < 1, UBound(Data) - offset, Length - 1)   'Update 2007-03-15  
    For I = offset To offset + Length  
        CRC16Lo = CRC16Lo Xor Data(I) '每一个数据与CRC寄存器进行异或  
        For Flag = 0 To 7  
            SaveHi = CRC16Hi  
            SaveLo = CRC16Lo  
            CRC16Hi = CRC16Hi \ 2            '高位右移一位  
            CRC16Lo = CRC16Lo \ 2            '低位右移一位  
            If ((SaveHi And &H1) = &H1) Then '如果高位字节最后一位为1  
                CRC16Lo = CRC16Lo Or &H80      '则低位字节右移后前面补1  
            End If                           '否则自动补0  
            If ((SaveLo And &H1) = &H1) Then '如果LSB为1,则与多项式码进行异或  
                CRC16Hi = CRC16Hi Xor CH  
                CRC16Lo = CRC16Lo Xor CL  
            End If  
        Next  
    Next  
    ReDim Result(1)  
    Result(0) = CRC16Lo              'CRC低位  
    Result(1) = CRC16Hi              'CRC高位  
End Sub  
  
'=================================  
'名称   GetLRC  
'参数   Data    Byte()  数据内容  
'       Offset  Integer 数组起始位置,默认值 0(从数组第一个元素开始)  
'       Length  Integer 计算长度,默认值 0(计算整个数组)  
'返回   Byte  
'说明   计算LRC值,Modbus ASCII中的校验码  
'日期   2014-10-05  
'=================================  
Private Function GetLRC(Data() As Byte, Optional ByVal offset As Integer = 0, Optional ByVal Length As Integer = 0) As Byte  
    Dim I As Integer, Result As Byte  
    If Length = 0 Then Length = UBound(Data) + 1  
    Result = 0  
    For I = offset To offset + Length - 1  
        Result = (CInt(Result) + Data(I)) Mod 256  
    Next  
    Result = (Not Result) + 1  
    GetLRC = Result  
End Function  
  
Private Sub PacketFrom(ByRef Data() As Byte, ByRef Result() As Byte, ByVal Protocol As ModbusProtocolType, Optional ByVal TCPID As Long = 0)  '协议校验  
    Dim I As Integer, C As Long, Str As String  
    Dim CRC() As Byte, Arr() As Byte  
    If Len(StrConv(Data, vbUnicode)) = 0 Then Exit Sub  
    C = UBound(Data) + 1  
    If C < 5 Then Exit Sub      '数据包长度过滤  
    Select Case Protocol  
        Case ModbusRTU    '0  
            GetCRC16 Data, CRC, 0, C - 2  
            If CRC(0) = Data(C - 2) And CRC(1) = Data(C - 1) Then 'CRC检查  
                ReDim Result(C - 3)  
                CopyMemory Result(0), Data(0), C - 2  
            End If  
        Case ModbusASCII  '1  
            If (Data(0) = 58) And (Data(C - 1) = 10) And (Data(C - 2) = 13) Then '头尾标记检查  
                Str = StrConv(Data, vbUnicode)  
                HexToArr Mid(Str, 2, Len(Str) - 3), Arr  
                C = UBound(Arr)  
                If GetLRC(Arr, , C - 1) = Arr(C) Then 'LRC检查  
                    ReDim Result(C - 1)  
                    CopyMemory Result(0), Arr(0), C - 1  
                End If  
            End If  
        Case ModbusTCP    '2  
            If Data(2) * 256 + Data(3) = 0 Then 'Modbus标记检查  
                C = Data(4) * 256 + Data(5)  
                If C = UBound(Data) - 5 Then '数据长度检查  
                    ReDim Result(C - 1)  
                    CopyMemory Result(0), Data(6), C  
                End If  
            End If  
        Case Else  
            '  
    End Select  
    Erase Arr  
    Erase CRC  
End Sub  
  
Private Sub PacketTo(ByRef Data() As Byte, ByRef Result() As Byte, ByVal Protocol As ModbusProtocolType, Optional ByVal TCPID As Long = 0) '协议封包  
    Dim CRC() As Byte, L As Long, Str As String  
    If Len(StrConv(Data, vbUnicode)) = 0 Then Exit Sub  
    L = UBound(Data) + 1  
    Select Case Protocol  
        Case ModbusRTU   '0  
            ReDim Result(L + 1)  
            GetCRC16 Data, CRC  
            CopyMemory Result(0), Data(0), L  
            CopyMemory Result(L), CRC(0), 2  
        Case ModbusASCII  '1  
            ReDim CRC(L)  
            CopyMemory CRC(0), Data(0), L  
            CRC(L) = GetLRC(Data)  
            Result = StrConv(":" & ArrToHex(CRC) & vbCrLf, vbFromUnicode)  
        Case ModbusTCP    '2  
            ReDim Result(L + 5)  
            CopyMemory Result(6), Data(0), L  
            Result(0) = TCPID \ 256  
            Result(1) = TCPID Mod 256  
            Result(2) = 0  
            Result(3) = 0  
            Result(4) = L \ 256  
            Result(5) = L Mod 256  
        Case Else  
            '  
    End Select  
    Erase CRC  
End Sub  
  
  
Public Sub ModbusClose(ByRef Handle As Long, Optional ByVal Protocol As ModbusProtocolType = DEFAULT_PROTOCOL)  
    Select Case Protocol  
        Case ModbusASCII, ModbusRTU  
            ComClose Handle  
        Case ModbusTCP  
            TCPClose Handle  
    End Select  
End Sub  
  
Public Function ModbusOpen(ByVal ModbusPort As String, Optional ByVal Protocol As ModbusProtocolType = DEFAULT_PROTOCOL, Optional ByVal ModbusSettings As String = "9600,n,8,1") As Long  
    Dim Result As Long  
    Select Case Protocol  
        Case ModbusASCII, ModbusRTU  
            Result = ComOpen(ModbusPort, ModbusSettings)  
        Case ModbusTCP  
            If IsNumeric(ModbusSettings) = False Then ModbusSettings = "502"  
            Result = TCPOpen(ModbusPort, CLng(ModbusSettings))  
    End Select  
    ModbusOpen = Result  
End Function  
笨狗先飞 2016-01-12
  • 打赏
  • 举报
回复
modSerialPort.bas =====================================================

Option Explicit  
Private Const DEFAULT_QUEUE = 1024  
Private Const DEFAULT_WAIT_TIME = 50  
  
Private Const GENERIC_READ = &H80000000  
Private Const GENERIC_WRITE = &H40000000  
Private Const OPEN_EXISTING = 3              '  
Private Const PURGE_RXABORT = &H2  
Private Const PURGE_RXCLEAR = &H8  
  
'Utils  
Private Const SYNCHRONIZE = &H100000  
Private Const STANDARD_RIGHTS_READ = &H20000  
Private Const ERROR_SUCCESS = 0&  
Private Const HKEY_LOCAL_MACHINE = &H80000002  
Private Const KEY_ENUMERATE_SUB_KEYS = &H8  
Private Const KEY_NOTIFY = &H10  
Private Const KEY_QUERY_VALUE = &H1  
Private Const KEY_READ = ((STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY) And (Not SYNCHRONIZE))  
Private Const REG_DWORD = 4  
  
'COM  
Private Type COMMTIMEOUTS  
        ReadIntervalTimeout As Long  
        WriteTotalTimeoutConstant As Long  
        ReadTotalTimeoutConstant As Long  
        WriteTotalTimeoutMultiplier As Long  
        ReadTotalTimeoutMultiplier As Long  
End Type  
  
Private Type COMSTAT  
        fBitFields As Long  
        cbInQue As Long  
        cbOutQue As Long  
End Type  
  
Private Type DCB  
    DCBlength As Long  
    Baudrate As Long  
    fBitFields As Long 'See Comments in Win32API.Txt  
    wReserved As Integer  
    XonLim As Integer  
    XoffLim As Integer  
    ByteSize As Byte  
    Parity As Byte  
    StopBits As Byte  
    XOnChar As Byte  
    XOffChar As Byte  
    ErrorChar As Byte  
    EofChar As Byte  
    EvtChar As Byte  
    wReserved1 As Integer 'Reserved; Do Not Use  
End Type  
  
Private Type OVERLAPPED  
    ternal As Long  
    hEvent As Long  
    offset As Long  
    OffsetHigh As Long  
    ternalHigh As Long  
End Type  
  
Private Type SECURITY_ATTRIBUTES  
        nLength As Long  
        bInheritHandle As Long  
        lpSecurityDescriptor As Long  
End Type  
  
'Common  
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)  
'COM  
Private Declare Function BuildCommDCB Lib "kernel32" Alias "BuildCommDCBA" (ByVal lpDef As String, lpDCB As DCB) As Long  
Private Declare Function ClearCommError Lib "kernel32" (ByVal hFile As Long, lpErrors As Long, lpStat As COMSTAT) As Long  
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long  
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, lpSecurityAttributes As SECURITY_ATTRIBUTES, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long  
Private Declare Function GetCommState Lib "kernel32" (ByVal nCid As Long, lpDCB As DCB) As Long  
Private Declare Function PurgeComm Lib "kernel32" (ByVal hFile As Long, ByVal dwFlags As Long) As Long  
Private Declare Function ReadFile Lib "kernel32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, lpOverlapped As OVERLAPPED) As Long  
Private Declare Function SetCommState Lib "kernel32" (ByVal hCommDev As Long, lpDCB As DCB) As Long  
Private Declare Function SetCommTimeouts Lib "kernel32" (ByVal hFile As Long, lpCommTimeouts As COMMTIMEOUTS) As Long  
Private Declare Function SetupComm Lib "kernel32" (ByVal hFile As Long, ByVal dwInQueue As Long, ByVal dwOutQueue As Long) As Long  
Private Declare Function WriteFile Lib "kernel32" (ByVal hFile As Long, ByRef lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, lpOverlapped As OVERLAPPED) As Long  
'Utils  
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long  
Private Declare Function RegEnumValue Lib "advapi32.dll" Alias "RegEnumValueA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpValueName As String, lpcbValueName As Long, ByVal lpReserved As Long, lpType As Long, lpData As String, lpcbData As Long) As Long  
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long  
  
'Utils  
Public Function EnumSerialPorts() As String  '枚举已存在的串口  
    Dim hKey As Long, ID As Long, Result As String  
    Dim Value As String, ValueLength As Long, Data As String, DataLength As Long  
    Result = ""  
    If RegOpenKeyEx(HKEY_LOCAL_MACHINE, "HARDWARE\DEVICEMAP\SERIALCOMM", 0&, KEY_READ, hKey) = ERROR_SUCCESS Then  
        Do  
            ValueLength = 2000  
            DataLength = 2000  
            Value = String(ValueLength, Chr(32))  '注册项  
            Data = String(DataLength, Chr(32)) '值 Com 名称  
            If RegEnumValue(hKey, ID, ByVal Value, ValueLength, 0&, REG_DWORD, ByVal Data, DataLength) = ERROR_SUCCESS Then  
                Result = Result & IIf(Len(Result) = 0, "", ",") & Trim(Replace(Left(Data, DataLength), Chr(0), Chr(32)))  
            Else  
                Exit Do  
            End If  
            ID = ID + 1  
        Loop  
        RegCloseKey hKey  
    End If  
    EnumSerialPorts = Result  
End Function  
  
'COM  
Public Sub ComClose(ByRef Handle As Long)  
    If Handle = -1 Then Exit Sub  
    CloseHandle Handle  
    Handle = -1  
End Sub  
  
Public Function ComOpen(ByVal Port As String, Optional ByVal Settings As String = "9600,n,8,1", Optional ByVal dwInQueue As Long = DEFAULT_QUEUE, Optional ByVal dwOutQueue As Long = DEFAULT_QUEUE) As Long  
    Dim Result As Long, lpDCB As DCB, lpCommTimeouts As COMMTIMEOUTS, lpSA As SECURITY_ATTRIBUTES  
    ComOpen = -1  
    If IsNumeric(Port) Then  
        Port = "\\.\Com" & Port  
    Else  
        Port = "\\.\" & Port  
    End If  
    Result = CreateFile(Port, GENERIC_READ Or GENERIC_WRITE, 0&, lpSA, OPEN_EXISTING, 0, 0&)  
    If Result = -1 Then Exit Function  
    If GetCommState(Result, lpDCB) = 0 Then  
        CloseHandle Result  
        Exit Function  
    End If  
    BuildCommDCB Settings, lpDCB  
    If SetCommState(Result, lpDCB) = 0 Then  
        CloseHandle Result  
        Exit Function  
    End If  
    SetupComm Result, dwInQueue, dwOutQueue  '分配串口缓冲区  
    '设定通讯超时参数  
    lpCommTimeouts.ReadIntervalTimeout = 2  
    lpCommTimeouts.ReadTotalTimeoutConstant = 4  
    lpCommTimeouts.ReadTotalTimeoutMultiplier = 3  
    lpCommTimeouts.WriteTotalTimeoutConstant = 5000 '一次写入串口数据的固定超时。  
    lpCommTimeouts.WriteTotalTimeoutMultiplier = 50 '写入每字符间的超时。  
    SetCommTimeouts Result, lpCommTimeouts  
    ComOpen = Result  
End Function  
  
Public Function ComReadByte(ByVal Handle As Long, ByRef Result() As Byte, Optional ByVal WaitTime As Long = DEFAULT_WAIT_TIME) As Long  
    Dim lpOverlapped As OVERLAPPED, lpStat As COMSTAT, lpErrors As Long  
    If Handle = -1 Then Exit Function  
    ComReadByte = 0  
    If WaitTime > 0 Then Sleep WaitTime  
    ClearCommError Handle, lpErrors, lpStat  
    If lpStat.cbInQue > 0 Then  
        ReDim Result(DEFAULT_QUEUE - 1) '设置缓冲区大小1K  
        ReadFile Handle, Result(0), lpStat.cbInQue, ComReadByte, lpOverlapped  
        If ComReadByte > 0 Then  
            ReDim Preserve Result(ComReadByte - 1)  
        Else  
            Erase Result  
        End If  
    End If  
End Function  
  
Public Function ComWriteByte(ByVal Handle As Long, ByRef Data() As Byte) As Long  
    Dim lpOverlapped As OVERLAPPED, lpErrors As Long, lpStat As COMSTAT  
    If (Handle = -1) Or (Len(StrConv(Data, vbUnicode)) = 0) Then Exit Function  
    PurgeComm Handle, PURGE_RXABORT Or PURGE_RXCLEAR  '清空输入缓冲区  
    WriteFile Handle, Data(0), UBound(Data) + 1, ComWriteByte, lpOverlapped  
    Do  
        ClearCommError Handle, lpErrors, lpStat  
    Loop Until lpStat.cbOutQue = 0  '等待输出结束  
End Function
笨狗先飞 2016-01-12
  • 打赏
  • 举报
回复
modTCPClient.bas ==================================================

    Option Explicit  
    Private Const DEFAULT_QUEUE = 1024  
    Private Const DEFAULT_WAIT_TIME = 50  
      
    'TCP  
    Private Const WSA_DescriptionLen = 256  
    Private Const WSA_DescriptionSize = WSA_DescriptionLen + 1  
    Private Const WSA_SYS_STATUS_LEN = 128  
    Private Const WSA_SysStatusSize = WSA_SYS_STATUS_LEN + 1  
    Private Const AF_INET = 2  
    Private Const SOCK_STREAM = 1  
    Private Const IPPROTO_TCP = 6  
    Private Const INADDR_NONE = &HFFFF  
    Private Const SOCKET_ERROR = -1  
      
    Private Type HostEnt  
        hName As Long  
        hAliases As Long  
        hAddrType As Integer  
        hLength As Integer  
        hAddrList As Long  
    End Type  
      
    Private Type SockAddr  
        Sin_Family As Integer  
        Sin_Port As Integer  
        Sin_Addr As Long  
        Sin_Zero(7) As Byte  
    End Type  
      
    Private Type WSADataType  
        wVersion As Integer  
        wHighVersion As Integer  
        szDescription As String * WSA_DescriptionSize  
        szSystemStatus As String * WSA_SysStatusSize  
        iMaxSockets As Integer  
        iMaxUdpDg As Integer  
        lpVendorInfo As Long  
    End Type  
      
    'Common  
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)  
    'TCP  
    Private Declare Function CloseSocket Lib "ws2_32.dll" Alias "closesocket" (ByVal hSocket As Long) As Long  
    Private Declare Function Connect Lib "ws2_32.dll" Alias "connect" (ByVal hSocket As Long, Addr As SockAddr, ByVal NameLen As Long) As Long  
    Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)  
    Private Declare Function GetHostByName Lib "ws2_32.dll" Alias "gethostbyname" (ByVal HostName As String) As Long  
    Private Declare Function Htons Lib "ws2_32.dll" Alias "htons" (ByVal HostShort As Integer) As Integer  
    Private Declare Function iNet_Addr Lib "wsock32.dll" Alias "inet_addr" (ByVal S As String) As Long  
    Private Declare Function Recv Lib "ws2_32.dll" Alias "recv" (ByVal hSocket As Long, Buf As Any, ByVal BufLen As Long, ByVal Flags As Long) As Long  
    Private Declare Function Send Lib "ws2_32.dll" Alias "send" (ByVal hSocket As Long, Buf As Any, ByVal BufLen As Long, ByVal Flags As Long) As Long  
    Private Declare Function Socket Lib "ws2_32.dll" Alias "socket" (ByVal af As Long, ByVal sType As Long, ByVal Protocol As Long) As Long  
    Private Declare Function WSACleanup Lib "ws2_32.dll" () As Long  
    Private Declare Function WSAStartup Lib "ws2_32.dll" (ByVal wVR As Long, lpWSAD As WSADataType) As Long  
      
    '=================================  
    '名称   GetHostByNameAlias  
    '参数   HostName  String 主机名  
    '返回   Long  
    '说明   将主机名转换成IP地址  
    '日期   2015-04-08  
    '=================================  
    Public Function GetHostByNameAlias(ByVal HostName As String) As Long  
        Dim Result As Long, hHost As HostEnt  
        GetHostByNameAlias = iNet_Addr(HostName)  
        If GetHostByNameAlias = INADDR_NONE Then  
            Result = GetHostByName(HostName)  
            If Result <> 0 Then  
                CopyMemory hHost, ByVal Result, LenB(hHost)  
                CopyMemory Result, ByVal hHost.hAddrList, LenB(Result)  
                CopyMemory GetHostByNameAlias, ByVal Result, hHost.hLength  
            End If  
        End If  
    End Function  
      
    Public Sub TCPClose(ByRef Handle As Long)  
        CloseSocket Handle  
        WSACleanup  
        Handle = -1  
    End Sub  
      
    Public Function TCPOpen(ByVal Host As String, Optional ByVal Port As Long = 502) As Long  
        Dim WSAData As WSADataType, SA As SockAddr, Result As Long  
        If WSAStartup(&H202, WSAData) <> 0 Then  
            WSACleanup  
        Else  
            If (InStr(Host, ":") > 0) Then  
                If IsNumeric(Right(Host, Len(Host) - InStr(Host, ":"))) = True Then  
                    Port = CLng(Right(Host, Len(Host) - InStr(Host, ":")))  
                End If  
                Host = Left(Host, InStr(Host, ":") - 1)  
            End If  
            Result = Socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)  
            SA.Sin_Family = AF_INET  
            SA.Sin_Port = Htons(CInt("&H" & Hex(Port)))  
            SA.Sin_Addr = GetHostByNameAlias(Host)  
            If Connect(Result, SA, LenB(SA)) = SOCKET_ERROR Then  
                WSACleanup  
                Result = -1  
            End If  
        End If  
        TCPOpen = Result  
    End Function  
      
    Public Function TCPReadByte(ByVal Handle As Long, ByRef Result() As Byte, Optional ByVal WaitTime As Long = DEFAULT_WAIT_TIME) As Long  
        Dim T As Double, I As Integer  
        If Handle = -1 Then Exit Function  
        If WaitTime > 0 Then Sleep WaitTime  
        ReDim Result(DEFAULT_QUEUE - 1)  
        TCPReadByte = Recv(Handle, Result(0), UBound(Result) + 1, 0)  
        If TCPReadByte > 0 Then  
            ReDim Preserve Result(TCPReadByte - 1)  
        Else  
            Erase Result  
        End If  
    End Function  
      
    Public Function TCPWriteByte(ByRef Handle As Long, ByRef Data() As Byte) As Boolean  
        TCPWriteByte = -1  
        If (Len(StrConv(Data, vbUnicode)) = 0) Or (Handle = -1) Then Exit Function '检查数据包大小  
        TCPWriteByte = Send(Handle, Data(0), UBound(Data) + 1, 0)  
        If TCPWriteByte = -1 Then  '通讯故障  
            Select Case Err.LastDllError  
                Case 10053  
                    TCPClose Handle  
                Case Else  
                    'Debug.Print Err.LastDllError  
            End Select  
        Else  
            TCPWriteByte = True  
        End If  
    End Function
笨狗先飞 2016-01-12
  • 打赏
  • 举报
回复
舉杯邀明月 2016-01-12
  • 打赏
  • 举报
回复
留个脚印,收藏一下。 我基本上是用不到的,若是以后有需要的时候再分析下这些代码。
Modbus Poll是一个主机仿真器,用来帮助开发人员测试Modbus从设备,或者其它MOdbus协议的测试和仿真。它支持多文档接口,即,可以同时监视多个从设备/数据域。每个窗口简单地设定从设备ID,功能,地址,大小和轮询间隔。你可以从任意一个窗口读写寄存器和线圈。如果你想改变一个单独的寄存器,简单地双击这个值即可。或者你可以改变多个寄存器/线圈值。提供数据的多种格式方式,比如浮点、双精度、长整型(可以字节序列交换)。 状态条显示错误信息。 如果你是一个从设备开发者,你可以通过"test center" 菜单,组织并发送你自己的测试字符串,并以16进制形式检查从设备返回的结果。 为VB,EXCEL等提供了OLE自动化接口。可以用OLE接口解析和显示Modbus数据,然后送达你指定的设备,即,在EXCEL中编辑数据,然后发送到你的从设备!示例参看安装后的Excel example.xls。 支持下列协议: Modbus RTU Modbus ASCII Modbus TCP/IP Modbus RTU Over TCP/IP Modbus ASCII Over TCP/IP Modbus UDP/IP Modbus RTU Over UDP/IP Modbus ASCII Over UDP/IP MODBUS POLL功能: OLE自动化可以简单地与Visual Basic接口,使用起来类似于ActiveX控件。参见 VBExample.vbp 读/写多达125个寄存器 读/写多达2000个输入/线圈 Test Center菜单 (组织你自己的测试字串) 打印和打印预览 监视串行数据流量serial data traffic Data logging to a text file Data logging direct to Excel 上下文敏感的HLP文件 10 Display formats such as float, double etc. Adjustable Address Base (0 or 1). 字体和颜色选项 广播功能(从设备ID=0) Easy control of RS-485 converters with RTS toggle. 支持MODBUS功能: 01: Read coil status 读线圈状态 02: Read input status 读输入状态 03: Read holding register读保持寄存器 04: Read input registers 读输入寄存器 05: Force single coil 强制单线圈 06: Preset single register 预置单寄存器 15: Force multiple coils 强制多线圈 16: Preset multiple registers 预置多寄存器 17: Report slave ID 报告从设备ID 22: Mask write register 屏蔽写寄存器 23: Read/Write registers 读/写寄存器
MEL 11/4/2002 Mitsubishi MELSEC I/O Driver MIE 3/28/2002 Mitsubishi Melsec-A Ethernet MIT 3/28/2002 Mitsubishi A Series MQE 3/29/2002 Mitsubishi Q-series Ethernet I/O driver MSX 3/29/2002 Mitsubishi Ethernet I/O Driver MEU 3/29/2002 Mitsubishi FX/485 Multidrop IO Driver MFX 3/29/2002 Mitsubishi FX Series I/O COM Driver MIN 11/5/1997 Mitsubishi Electric Inverter I/O Driver A30 11/14/2002 ABB Kent Taylor Mod 30 ABC 10/31/2002 Allen-Bradley CyberLogic DHX Driver ABD 7/3/2002 Allen-Bradley DF1 Half Duplex ABH 5/3/2002 Allen-Bradley Data Highway ABR 1/9/2003 Allen-Bradley RSLinx v7.28 ADM 3/28/2002 Azonix 1050, 1060, 6000 APX 3/28/2002 Moore APACS BR3 3/28/2002 Bristol Babcock EGD 11/19/2002 Ethernet Global Data EIM 3/28/2002 Honeywell/EIM 620 EUR 3/28/2002 Eurotherm 800 Series FSH 3/28/2002 Fisher CHIPS (UNIVOX & PROVOX) G90 3/28/2002 GE-Fanuc-SNP GE6 3/28/2002 GE-Fanuc- CCM2 GE9 10/17/2002 GE-Fanuc-Ethernet v7.17 GEF 12/28/2002 GE Fanuc GIO 3/28/2002 GE Fanuc-Genius HIT 3/28/2002 Hitachi S10 Driver I3E 11/7/2002 IEEE 488.2 I/O Driver IGS 11/25/2002 Intellution Gateway Server for Allen-Bradley IPC 3/28/2002 Honeywell IPC 620 ITM 3/28/2002 Intermec Barcode Readers JYC 3/28/2002 Johnson-Yokogawa YS 100 Series M32 11/7/2002 M32 Mycro 352/382 MB1 11/22/2002 Modicon Modbus I v7.15 MBE 1/6/2003 Modbus Ethernet version 7.17 MBR 3/28/2002 Modicon MODBUS Remote MMP 12/9/2002 Modicon Modbus Plus MOA 11/4/2002 Klockner-Moeller MOA-Series MSA 3/28/2002 Mine Safety MT1 3/28/2002 Met One I/O Driver MTL 3/28/2002 Mettler Weighing Terminals MX1 11/4/2002 Leeds and Northrup Max1 OMF 3/28/2002 Omron Fins OMR 3/28/2002 Omron Host Link OP2 3/28/2002 Opto 22 OPTOMUX OPC 10/21/2002 OPC Client Driver OPM 3/28/2002 Opto22 Mistic OPX 3/28/2002 Opto 22 Mistic PDN 3/28/2002 PLC Directnet DL405 I/O RAM 3/28/2002 Reliance Electric Auto-Max REA 3/28/2002 Reliance Elec. Automate 15/20/30/40 ROC 10/22/2002 Fisher Remote Operations Controller S2G 12/11/2002 SECS11/GEM I/O Driver SDE 3/28/2002 Square D PLC's SH1 5/31/2002 Siemens H1 SI7 10/18/2002 Siemens Simatic S7 (300 & 400) SIE 3/28/2002 Siemens 3964r SL4 10/18/2002 Siemens Layer 4 SM2 6/7/2002 Simulation 2 Driver SQD 3/28/2002 Square D SY/MAX 300,400,500,700 SYL 3/28/2002 Square D Sylink TBP 3/28/2002 Texas Instruments Transparent Byte Protocol TIA 3/28/2002 Texas Instrument Unilink PC Adapter TID 8/15/2002 Texas Instrument Direct TIE 11/27/2002 Texas Instruments TIH 3/28/2002 Texas Instrument Highway (TIWAY) TTS 3/28/2002 Toshiba Prosec T-Series I/O Driver TUT 3/28/2002 Telemecanique Uni-Telway I/O Driver UDC 3/28/2002 Honeywell UDC Controllers WDE 3/28/2002 Woodward Modbus Ethernet Driver WIM 3/28/2002 Westinghouse IMPACC YKG 3/28/2002 Johnson-Yokogawa DARWIN 600 3/31/2002 Landis & Staefa APOGEE System 600 Database Dynamos ABB 10/16/1997 ABB P4000 I/O Serial Driver ABO 3/29/2002 Allen Bradley OPC Server AD4 3/29/2002 Adam 4000 Series Data Acquisition Modules AD5 3/29/2002 Adam 5000 Series Data Acquisition Modules AEO 3/29/2002 Aeonic Gauging System AND 5/15/2002 ANDVOVER - 256 APC 3/29/2002 Applicom FIX I/O Driver ARC 3/29/2002 ARCNet Driver for Siemens SIMATIC S5 and FC-50 AS9 6/20/2002 Accu-sort Model 9000 Barcode ASE 6/5/2002 ABB Excom for Masterpiece 2xx & Advant Controller 4xx AST 3/29/2002 AST Teleperm M I/O Driver ATI 3/29/2002 ATI Beta Gauge ATN 3/29/2002 Athena XT / AT Controllers AVR 3/29/2002 Avery L105 Weigh Bridge AX3 11/14/1998 Ansi X-3 I/O SERIAL DRIVER (Field 1000 module driver) B90 3/29/2002 Bailey INFI 90 / NETWORK 90 / Command Series OPC Server BAC 6/20/2002 BACnet (OPC) BCM 3/29/2002 Barber Coleman MAQ PID Controller BDL 6/20/2002 Bailey Fischer and Porter Datalink BEL 3/29/2002 Foxboro 761 Controllers BIO 3/29/2002 Bailey Infi90 semAPI OPC Server C43 3/29/2002 Siemens TCP/IP I/O Driver CEN 3/29/2002 Johnson-Yokogawa Centum CS CHI 6/5/2002 Cutler Hammer D300 CIU 3/29/2002 ABB/Bailey Command Series OPC Server and Console CIU 3/29/2002 ABB/Bailey Net 90 & Infi 90 DCS via Serial Connection CM4 3/29/2002 Zellweger - MDA Scientific CM4 Multipoint Gas Analyzer CNN 6/5/2002 Conlog/OmniFlex Conet Network with SER Feature CNT 3/29/2002 Johnson-Yokogawa Centum V CTD 3/29/2002 Control Techniques DC Drive Mentor II CTU 3/29/2002 Control Techniques Uni-Drive CVM 3/29/2002 CVM Electrical Network Analyser CYD 3/29/2002 Johnson-Yokogawa Micro-XL DCS and Centum XL DCS D25 3/29/2002 DANIEL 2500 Flow Computer DGH 3/29/2002 DGH 1000/2000/3000/4000 Modules DLC 3/29/2002 Chino-Laxsons DLC DS7 10/1/1998 Datascan 7000 EMC 3/29/2002 Emicon EC-2000 I/O driver FB7 3/29/2002 Foxboro 760, 761, 762 Loop Controller FBR 6/20/2002 Beta MFG1001XY Fibre Gauge FCI 6/5/2002 Festo Command Interface for 405, 202, 101 FCN 6/14/2002 Fuji N Series Controller FFK 6/14/2002 Fuji Micrex - F 60 / 80 / 100 / 120 / 80H / 120H FIA 3/29/2002 Foxboro IA G2T 3/29/2002 Computer Products G2 TCP/IP Driver GAS 6/20/2002 Air Products Gas Guard GAU 3/29/2002 Gaugeport GEM 10/1/1998 GEM80 Esp I/O Serial Driver GEN 3/29/2002 GENIBus Central Control Unit (CU3) and Sensor Module (SM100) GEX 6/5/2002 GEC GEM 80 GPI 3/30/2002 Serial ASCII Driver GW5 3/29/2002 Honeywell IPC620 on Gateway 500 HDC 3/29/2002 Honeywell UDC 1000, 1500 HG5 10/16/1997 Honeywell Gateway 500 I/O driver for FIX DMACS / MMI. HIT 7/10/2002 Hitachi S10/2a and S10/4a PLC's I87 6/10/2002 IEC 870-5-103 & 101 Standard Protocol driver I90 3/29/2002 Bailey Infi90 semAPI IBU 8/16/2000 Phoenix Interbus-S ICI 3/29/2002 Moore 320 and 352 Single Loop Controllers IMC 3/28/2002 IMC VB Driver for the Wind Turbine Controller IMS 3/29/2002 Brooks PetroCount IMS Model 0501D Electronic Batch Preset INC 6/10/2002 Cutler Hammer / Westinghouse Incom Via EPONI/EMINT IRI 8/16/2000 Ingersol-Rand Compressors JCI 3/29/2002 Johnson Controls Metasys I/O Driver JYR 3/29/2002 Johnson-Yokogawa Recorder KM4 6/10/2002 Moeller Sucom A LFE 3/29/2002 LFE Profitmaster LNI 3/29/2002 Lonworks Network Driver LOM 3/29/2002 Lomicont I/O driver M42 8/16/2000 Metter/Toledo Digital Scales MAS 3/29/2002 Masibus 8030 Data Logger MCN 3/30/2002 MCNET IO Driver MES 3/29/2002 Messung XMP8-40 PLC MGA 3/29/2002 Lectotek Microgenie Analog Scanner MGE 3/29/2002 Lecrotek Microgenie Controller MGS 3/29/2002 Lectrotek Microgenie Digital Scanner MGT 3/29/2002 Motorola MDLC Gateway Ethernet Driver NM4 3/29/2002 Azonix MicroMAC-4000 MP2 3/29/2002 Micon P200 Controller MPI 3/29/2002 MPI Driver for Siemens SIMATIC S7 MTS 3/29/2002 Teletherm MTS - 64 MTW 3/29/2002 Mettler Toledo 9411-E MXL 3/29/2002 Johnson-Yokogawa Micro XL DCS NG4 3/29/2002 NexGen 4000 Series PLC NUM 8/17/2000 Westinghouse Numa-Logic PC-700 OSG 3/29/2002 Landis & Staefa APOGEE System 600 I/O Driver OSV 6/13/2002 Descartes OmniServer OVH 8/16/2000 Omron SYSMAC Net (Res Driver) P2K 3/29/2002 Westinghouse W2500, P2000 PBK 11/18/2002 Profibus Kombi Softing PCX 10/16/1997 Microsol PCX2000 MODBUS Driver PHL 3/29/2002 Philips 1592/02 Batch Controller PMM 3/29/2002 Vectra 3720 ACM Power Measurement Meter PMT 3/29/2002 LASAIR & HSLIS Particle Counting Interface PRO 5/8/2002 Fisher-Rosemount PROVOX OPC Server PWT 3/29/2002 Siemens Power Trak Meter RAX 3/29/2002 Reliance Electric Automax REM 3/29/2002 Remicont R-130 I/O Driver RNI 3/29/2002 Fisher Rosemont RS/3 RNI TCP/IP Driver RT5 6/10/2002 ABB Spider RP570 & 571 Serial Event Recording S7A 4/30/2002 Siemens S7 TCP/IP S7B 6/3/2002 Siemens S7 MPI serial S7M 3/29/2002 Siemens S7-MPI-Bus SBS 11/5/1997 Satt Bus 1 I/O RES Driver SCI 3/29/2002 Fisher Rosemount RS/3 SCI Driver SCR 3/29/2002 SIXNET Control Room SCS 3/29/2002 ABB/Bailey Net 90 & Infi 90 DCS via SCSI Connection SCS 3/29/2002 Landis & Staefa Control System NCRS I/O Driver SDG 3/29/2002 SCADA Data Gateway SDR 3/29/2002 Siemens Sipart DR19, 20, 24 Controller SFA 3/29/2002 STAEFA HVAC Serial Interface SIS 8/20/2002 Siemens Serial MPI SIX 6/10/2002 Siemens Industrial Ethernet SNI 3/31/2002 Landis & Staefa Control Systems NITEL I/O SPA 6/5/2002 ABB SPA Relay Controller Bus SPM 8/16/2000 Siemens Power Meters SRM 3/30/2002 RKC Instruments, Inc. FAREX SR Mini (OPC) TBA 6/10/2002 Toshiba T Series TDC 7/16/2002 Honeywell TDC2000/3000 TEC 3/29/2002 Toshiba EC300 Series Controller TIB 3/29/2002 TIBCO - Rendezvous Message Bus Interface TIE 3/29/2002 Texas Instruments TI/5 CTI or Siemens Driver TIG 6/5/2002 Amdel Thickner Interface Gauge TIO 3/29/2002 Texas Instruments TI/5 OPC Server YMO 3/29/2002 Teleperm FIX I/O Driver YSD 3/29/2002 Toshiba TOSDIC 211D MiniSystem U01 3/30/2002 SMAR LD-301 Intelligent Pressure Transmitter (OPC) U15 8/17/2000 Yokogawa UT15L - Limit Controller (OPC) U41 3/30/2002 Industrial Control Links ICL-4130 RTU (OPC) U51 7/10/2002 Fischer-Rosemount Model 1151 Smart Pressure Transmitter (HART) (OPC) U55 8/17/2000 Yokogawa UP550 - Program Controller (OPC) U56 6/20/2002 Barber-Coleman 560 Microprocessor Controllers (OPC) U7F 6/20/2002 Barber-Coleman 7EF/7HF Temperature Controller (OPC) UA5 3/30/2002 US Digital Corporation's Quadrature Encoder to SEI Adapter (OPC) UAD 6/20/2002 Advantech ADAM 4000 Series (OPC) UEM 7/10/2002 Eurotherm EM-1 Process Controller (OPC) UET 3/30/2002 Nobel Systems E1TAD (OPC) UFC 3/30/2002 Sentinal 500 Gas Orifice Flow Computer (OPC) UFG 7/10/2002 Fuji Chip Placer CP-6, Multi-Function Mounter IP-III UGS 7/10/2002 GSC Model 2700 RTU (OPC) UH3 7/16/2002 Honeywell UDC3000 Controller (OPC) UHB 7/16/2002 Honeywell BDI Protocol (OPC) ULP 3/30/2002 Sartorious LP 6200 S Balance (OPC) ULS 3/30/2002 Symbol LS 4071 Scanner (OPC) UM6 3/30/2002 Partlow MIC 6000 Profiling Controller (OPC) UMB 11/9/2001 Modbus RTU (OPC) UMI 3/30/2002 Measurement Systems International, Inc. MSI-6260 Trans-Weight (OPC) UML 6/19/2002 MLC 9000 system UMN 11/9/2001 Microscan Systems, Inc. MS-710 Barcode Scanner (OPC) UMS 3/30/2002 MICRISTAR 828D and 828E heat processing controllers (OPC) UNI 3/30/2002 Marathon Monitors Carbpro Version 3.0 (OPC) UOS 11/9/2001 Universal OPC Server (UOS) (OPC) UP1 3/30/2002 Praxair Ultrapurge 100 (UP100) Gas Cabinet Controller (OPC) UPA 3/30/2002 Praxair Ultrapurge VMB Gas Cabinet Controller (OPC) UPC 3/30/2002 Premier Pneumatics, Inc. ProController (OPC) UPD 3/30/2002 Red Lion Model PAXD-1/8 DIN Universal Input Panel Meter (OPC) USF 6/20/2002 Daniel Flow Products, Inc. SolarFlow Plus 2480 Meter (OPC) USG 3/30/2002 Siemens Intelligent SwitchGear System (ISGS) (OPC) USK 6/20/2002 Advantage Electronics Sentra 揝K?Mold Temperature Controller (OPC) USN 3/30/2002 SIXNET IOMUX RTU (OPC) USY 3/30/2002 Omni Link LL500 (OPC) UT5 3/30/2002 Target Systems, Inc. TS5000 Industrial Control Terminal (OPC) UTM 7/10/2002 Dynalco Controls TM5000 Scanner (OPC) UTT 8/17/2000 Trane Tracer 100 (OPC) UW5 3/30/2002 Watlow 945 Auto Tuning Control (ANSI X3.28 protocol) (OPC) UW8 3/30/2002 Watlow 988 Temperature/Process Controller (ANSI X3.28 protocol) (OPC) UWA 3/30/2002 Watlow 982 Ramping Controller (ANSI X3.28 protocol) (OPC) UWM 3/30/2002 Watlow 982 Ramping Controller (Modbus RTU protocol) (OPC) UWS 3/30/2002 Maguire Products, Inc. Maguire Weigh Scale Blender (OPC) VBH 3/29/2002 Beckhoff TwinCAT FIX I/O Driver VIP 3/29/2002 VIPA TCP/IP I/O Driver VJD 3/29/2002 Videojet Driver W61 3/30/2002 West Instruments, Inc. WST 3/29/2002 WEST 4400 SetPoint Programmer & 2052 Multi-Program Controllr WTV 10/16/1997 Wallace & Tiernan V595 I/O Serial Driver XL1 3/29/2002 XL100 Single Loop Controller XRP 10/1/1998 M215 X-ray Profilemeter Guage Driver Y48 3/29/2002 YEW 4081 YCS 3/29/2002 Johnson-Yokogawa Centum CS DCS YGN 3/29/2002 Johnson-Yokogawa Green Series Driver YK1 3/29/2002 Johnson-Yokogawa UT/UP/UM Controller YKS 3/29/2002 Johnson-Yokogawa UT/ UM / UP Series Loop Controller YKX 3/29/2002 Johnson-Yokogawa UT/UM Series Advanced I/O YRC 3/29/2002 Johnson-Yokogawa Hybrid 2500 Recorder YSL 3/29/2002 Johnson-Yokogawa YS-80 Series Loop Controller YTK 3/30/2002 York Talk XL Controller and Linc Chiller YT ZEL 3/29/2002 ZELLWEGER System 16 Gas Analyzer ZIT 6/5/2002 Ziton Fire Panel

741

社区成员

发帖
与我相关
我的任务
社区描述
VB 版八卦、闲侃,联络感情地盘,禁广告帖、作业帖
社区管理员
  • 非技术类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧