cadtlf
級別: 探索解密
|
小弟最近做做一個項目,要求用vb做為上位機與plc通信,本人以前只用過HMI,對VB不太孰悉,各位大蝦vb與plc如何通信呢.有沒有實例程序供小弟參考下.謝謝 |
---|---|
|
shuangyu
工控行業呆的越久越迷茫.......懂得多?少?......
級別: 家園常客
|
Function NewPLCFXENTE(ByVal PortNum As String) As Object Try Dim PLCFX As New ActProgTypeLib.ActProgType Dim PLCType As Integer = 520 Dim PLCUnitType As Integer = 74 Dim PLCUnitNumber As Integer = 0 Dim PLCPrgType As Integer = 5 Dim PLCHostAddress As String = "" Dim PLCTimeOut = 500 With PLCFX .ActCpuType = PLCType .ActUnitType = PLCUnitType .ActUnitNumber = PLCUnitNumber .ActProtocolType = PLCPrgType ' .ActHostAddress = "192.168.1." & PortNum .ActHostAddress = PortNum .ActTimeOut = PLCTimeOut End With Return PLCFX Catch ex As Exception MsgBox(ex.Message) MLog.LogErrWrite(ex.ToString) End Try End Function PLC0 = PLCM.NewPLCFXENTE(IPAddress(0)) PLCConErr(0) = PLC0.Open |
---|---|
|
shuangyu
工控行業呆的越久越迷茫.......懂得多?少?......
級別: 家園常客
|
是的,適用于FX3U-ENET-ADP 模塊;其他端口可能設置參數不一樣 |
---|---|
本帖最近評分記錄: |