大神,你好 。我最近在学VB.net,我需要与omron或者三菱PLC进行通讯,有案例嘛?西门子:WinTcpS7,三菱:EntQsPlc,欧姆龙:FinsTCP,百度都能搜到资源的;
谁有VB和OMRON PLC 通信例子?。磕芊穹⒏鲈即耄?再次特别感谢!提供一个VB.NET与OMRON以太网通讯的代码,是我项目里面复制出来的:
Dim Handle1 As Int32 'PLC的连接句柄
Dim EntLink As Boolean '连接标志
Dim PLC As New FinsTcp.PlcClient '引用OMRON的通讯组件
Private Sub butLink_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butLink.Click
Dim re As Short
Dim restr As String = ""
re = PLC.EntLink(Trim(txtLocalIP.Text), Val(txtLocalPort.Text), Trim(txtRemoteIP.Text), Val(txtRemotePort.Text), "DEMO", Handle1)
txtReLink.Text = re.ToString
If re = 0 Then
EntLink = True
MsgBox("PLC联接成功! ")
Else
EntLink = False
MsgBox("PLC联接失败: "restr)
End If
End Sub
Private Sub butClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butClose.Click
Dim re As Short
EntLink = False
re = PLC.DeLink(Handle1)
txtReClose.Text = re.ToString
End Sub
Private Sub butRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butRead.Click
【关于vb.netomron的信息】Dim re As Short
Dim i As Short
Dim RD() As Object
ReDim RD(Val(txtReadCnt.Text - 1))
If Not EntLink Then
MsgBox("还未与PLC建立联接!")
Exit Sub
End If
Dim mry As FinsTcp.PlcClient.PlcMemory = cmbReadMry.SelectedIndex + 1
Dim typ As FinsTcp.PlcClient.DataType = cmbReadType.SelectedIndex + 1
re = PLC.CmdRead(Handle1, mry, typ, CUShort(Val(txtReadAdd.Text)), CUShort(Val(txtReadCnt.Text)), RD)
txtReRead.Text = re.ToString
lstRead.Items.Clear()
For i = 0 To UBound(RD) Step 1
If Not IsNothing(RD(i)) Then lstRead.Items.Add(RD(i))
Next i
If re0 Then
Timer1.Enabled = False
butScan.Text = "Cycle R/W"
End If
End Sub
Private Sub butWrite_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butWrite.Click
Dim re As Short
Dim i As Short
Dim temp() As String
Dim WD() As Object
If Not EntLink Then
MsgBox("还未与PLC建立联接!")
Exit Sub
End If
ReDim WD(Val(txtWriteCnt.Text) - 1)
temp = Split(txtWrite.Text, vbCrLf)
For i = 0 To UBound(WD) Step 1
If iUBound(temp) Then
WD(i) = 0
Else
WD(i) = Trim(temp(i))
End If
Next i
Dim mry As FinsTcp.PlcClient.PlcMemory = cmbWriteMry.SelectedIndex + 1
Dim typ As FinsTcp.PlcClient.DataType = cmbWriteType.SelectedIndex + 1
re = PLC.CmdWrite(Handle1, mry, typ, CUShort(Val(txtWriteAdd.Text)), CUShort(Val(txtWriteCnt.Text)), WD)
txtReWrite.Text = re.ToString
If re0 Then
Timer1.Enabled = False
butScan.Text = "Cycle R/W"
End If
End Sub
vb.net update语法update
英语单词,主要用作为动词、名词 , 作动词时译为“更新;校正,修正;使现代化”;作名词时译为“更新;现代化” 。
词性:动词、名词
英式读音[??p?de?t]
美式读音[??p?de?t]
单词用法
V-T/V-I If you update something, you make it more modern, usually by adding new parts to it or giving new information. 更新
N-COUNT An update is a news item containing the latest information about a particular situation. 最新消息; 快讯
V-T If you update someone on a situation, you tell them the latest developments in that situation. 给…提供最新信息
词组短语
update information 更新信息;修正信息
dynamic update 动态更新;动态升级
last update 最新更新
update now 立即更新
推荐阅读
- mysql的数据库名字怎么改,mysql怎么修改数据库名字
- sqlserver注册表,sqlserver注册表自动清理工具
- gis坐标四至点,arcgis四至点坐标标注
- 新西兰手机怎么收费,新西兰网络怎么收费
- java实现车牌识别代码 java车牌识别源代码
- 公众号播放量怎么赚钱,公众号视频播放量
- sqlserver数据库中所有库名,sql server数据库包含哪几种文件
- 武林风手机直播,武林风官方直播软件下载
- 数据库实时数据展示php 实时数据库 pai