可以用VB做一個輔助程序,VB和組態(tài)王之間通過DDE連接,這跡純個在組態(tài)王的自帶資料里有,也可升州閉以使用OPC連接,直接使用微軟自帶的OPC組件即可,類似資吵裂料網(wǎng)上有很多。
公司主營業(yè)務(wù):成都網(wǎng)站制作、網(wǎng)站設(shè)計、移動網(wǎng)站開發(fā)等業(yè)務(wù)。幫助企業(yè)客戶真正實現(xiàn)互聯(lián)網(wǎng)宣傳,提高企業(yè)的競爭能力。創(chuàng)新互聯(lián)是一支青春激揚(yáng)、勤奮敬業(yè)、活力青春激揚(yáng)、勤奮敬業(yè)、活力澎湃、和諧高效的團(tuán)隊。公司秉承以“開放、自由、嚴(yán)謹(jǐn)、自律”為核心的企業(yè)文化,感謝他們對我們的高要求,感謝他們從不同領(lǐng)域給我們帶來的挑戰(zhàn),讓我們激情的團(tuán)隊有機(jī)會用頭腦與智慧不斷的給客戶帶來驚喜。創(chuàng)新互聯(lián)推出昌邑免費(fèi)做網(wǎng)站回饋大家。
用 vb點虐 socket通信
Dim th As Threading.Thread
2 Dim tcpl As System.Net.Sockets.TcpListener
3
4 Private Sub Form1_Load()Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
5 th = New System.Threading.Thread(New System.Threading.ThreadStart(AddressOf MyListen))
6 th.Start()
7 End Sub
8
9 Public Sub SendMessage()Sub SendMessage(ByVal IP As String, ByVal SendMsg As String)
10 Try
11 If IP "" Then
12 Dim tcpc As New System.Net.Sockets.TcpClient(IP, 5656)
13 Dim tcpStream As Net.Sockets.NetworkStream = tcpc.GetStream
14 Dim reqStream As New IO.StreamWriter(tcpStream)
15 reqStream.Write(SendMsg)
16 reqStream.Flush()
17 tcpStream.Close()
18 tcpc.Close()
19 End If
20 Catch ex As Exception
21 MsgBox(ex.Message.ToString)
22 End Try
23 End Sub
24 Private Sub MyListen()Sub MyListen()
25 Try
26 Dim ipAddress As System.Net.IPAddress = System.Net.Dns.Resolve(System.Net.Dns.GetHostName).AddressList(0)
27 tcpl = New System.Net.Sockets.TcpListener(ipAddress, 5656)
28 tcpl.Start()
29 While True
30 Dim s As System.Net.Sockets.Socket = tcpl.AcceptSocket()
31 Dim MyBuffer(1024) As Byte
32 Dim i As Integer
33 i = s.Receive(MyBuffer)
34 If i 0 Then
35 Dim lstrRec As String
36 Dim j As Integer
37 For j = 0 To i - 1
38 TextBox1.Text += Chr(MyBuffer(j)) ","
39 Next
40 End If
41 End While
42 Catch ex As Exception
43 MsgBox(ex.Message.ToString)
44 End Try
45 End Sub
46
47 Private Sub Button1_Click()Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
48 SendMessage("192.168.0.61", TextBox2.Text)
49 End Sub
主要看你的物理連接方式,觸摸屏的驅(qū)動支持。例如:MCGS和組態(tài)王通信,可以用Modbus協(xié)議。MCGS為主,組態(tài)王為從(反之亦可)。MCGS觸摸屏有地址轉(zhuǎn)發(fā)功滑頌?zāi)?,直接在觸摸屏內(nèi)建點,轉(zhuǎn)發(fā)到對應(yīng)串口。孫改組態(tài)王內(nèi)配置相應(yīng)參數(shù),如:地址,波特率,則讓判COM口等信息。建立對應(yīng)地址,即可通信。
組態(tài)王通訊中斷恢復(fù)顯示問號說明通信有問題。根據(jù)查詢相關(guān)資料信息:先聯(lián)系組態(tài)王公司讓他給你做一個新的驅(qū)動,安裝之后通信看看在不行就搞一臺PLC試罩談一試,一般都是驅(qū)動芹襲和PLC編程口問題這兩個不是一個廠家有些不兼容這個很正常物首碰。