RSS
当前位置 :| 主页>编程实例>

S7-200自由口通讯VB程序

来源: 作者: 时间:2007-10-16 Tag: 点击:

Dim Address_R As String
Dim Address_W As String
Dim Address_B As String
Dim ReadPlc As Boolean
Dim Lenth As Double
Dim SetLenth As Double
Dim Bit As String
Dim Instruction As Byte

Private Sub Combo1_Click()

  Select Case Combo1.Text
    Case "IB"
      Address_R = "0000"
      Lenth = 1
    Case "ID"
      Address_R = "0000"
      Lenth = 4
    Case "IW"
      Address_R = "0000"
      Lenth = 2
    Case "QB"
      Address_R = "0100"
      Lenth = 1
    Case "QD"
      Address_R = "0100"
      Lenth = 4
    Case "QW"
      Address_R = "0100"
      Lenth = 2 字串6
    Case "MB"
      Address_R = "0200"
      Lenth = 1
    Case "MD"
      Address_R = "0200"
      Lenth = 4
    Case "MW"
      Address_R = "0200"
      Lenth = 2
    Case "VB"
      Address_R = "0800"
      Lenth = 1
    Case "VD"
      Address_R = "0800"
      Lenth = 4
    Case "VW"
      Address_R = "0800"
      Lenth = 2
   End Select
End Sub


Private Sub Combo2_Click()
Select Case Combo2.Text
    Case "IB"
      Address_W = "0000"
      SetLenth = 1
    Case "ID" 字串2
      Address_W = "0000"
      SetLenth = 4
    Case "IW"
      Address_W = "0000"
      SetLenth = 2
    Case "QB"
      Address_W = "0100"
      SetLenth = 1
    Case "QD"
      Address_W = "0100"
      SetLenth = 4
    Case "QW"
      Address_W = "0100"
      SetLenth = 2
    Case "MB"
      Address_W = "0200"
      SetLenth = 1
    Case "MD"
      Address_W = "0200"
      SetLenth = 4
    Case "MW"
      Address_W = "0200"
      SetLenth = 2
    Case "VB"

字串7


      Address_W = "0800"
      SetLenth = 1
    Case "VD"
      Address_W = "0800"
      SetLenth = 4
    Case "VW"
      Address_W = "0800"
      SetLenth = 2
   End Select
End Sub



Private Sub Combo3_Click()
   Select Case Combo3.Text
     Case "Q"
        Address_B = "0100"
     Case "M"
        Address_B = "0200"
     Case "V"
        Address_B = "0800"
   End Select
End Sub


Private Sub Combo4_Click()
   Select Case Combo4.Text
      Case "0"
        Bit = "00"
上一页12 3 4 5 下一页
Google
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册