国产免费AV|泡泡玛特欧洲总部将设在伦敦|中文天堂网www新版资源在线|一本久道综合在线中文|国精产品一二三产区的使用方法|香蕉鱼在线观看|www.27eee

 找回密碼
 注冊
搜索

VB開發(fā)的串口與三菱FX PLC通訊源碼

[復(fù)制鏈接]
樓主
coolice 發(fā)表于 2020-4-25 15:50:20 | 只看該作者 |只看大圖 |倒序瀏覽 |閱讀模式
VB開發(fā)的串口與三菱FX PLC通訊源碼 1.jpg
  1. Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  2.         lblTopic = "輸入要監(jiān)控或設(shè)置的地址回車確定,如D0,T10,Y7等"
  3. End Sub

  4. Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
  5.         If KeyCode <> 13 Then
  6.             start = False
  7.         End If
  8. End Sub

  9. Private Sub Text2_KeyPress(KeyAscii As Integer)
  10.     char = Chr(KeyAscii)
  11.     KeyAscii = Asc(UCase(char))
  12.     If Device = "D" And CStr(Val(setad)) = setad And Val(setad) < 1000 Then
  13.         start = False
  14.     End If
  15.     If (Device = "T" Or Device = "C") And CStr(Val(setad)) = setad And Val(setad) < 256 Then
  16.         start = False
  17.     End If
  18.     If KeyAscii = 13 Then
  19.       If Val(DevAdd) > 7999 Then
  20.          If MsgBox("改變系統(tǒng)參數(shù)可能對系統(tǒng)造成破壞,是否寫入?", vbOKCancel + vbCritical) = vbCancel Then Exit Sub
  21.       ElseIf MsgBox("改變當(dāng)前值可能對運行造成危險,是否寫入?", vbOKCancel + vbExclamation) = vbCancel Then Exit Sub
  22.       End If
  23.             If Device = "D" And Check1.Value = 0 Then
  24.                 DevAdd = Right(("0000" + setad), 4)
  25.             ElseIf Device = "D" And Check1.Value = 1 Then
  26.                 DevAdd = Right(("0000" + setad), 4)
  27.             Else
  28.                 DevAdd = Right(("000" + setad), 3)
  29.             End If
  30.             If OptionD.Value Then '十進(jìn)制方式
  31.                 If Device = "C" And Val(setad) > 199 Then 'C200以上寫入
  32.                     If Val(Text2.Text) > 2847483647# Then: GoTo this
  33.                     DevDat1 = cboStation.Text + "FFWW0" + Device + "N" + DevAdd + "01" + Right("00000000" + Hex(Val(Text2.Text)), 8)
  34.                 ElseIf Device = "D" And Check1.Value = 1 Then '雙字節(jié)D寫入
  35.                     If Val(Text2.Text) > 2847483647# Then: GoTo this
  36.                     DevDat1 = Right("00000000" + Hex(Val(Text2.Text)), 8)
  37.                     DevDat1 = Right(DevDat1, 4) + Left(DevDat1, 4)
  38.                     DevDat1 = cboStation.Text + "FFWW0" + Device + DevAdd + "02" + DevDat1
  39.                 Else
  40.                     If Val(Text2.Text) > 32767 Then: GoTo this
  41.                     If Device = "D" Then '單字節(jié)D寫入
  42.                         DevDat1 = cboStation.Text + "FFWW0" + Device + DevAdd + "01" + Right("0000" + Hex(Val(Text2.Text)), 4)
  43.                     Else 'C200以下寫入
  44.                         DevDat1 = cboStation.Text + "FFWW0" + Device + "N" + DevAdd + "01" + Right("0000" + Hex(Val(Text2.Text)), 4)
  45.                     End If
  46.                 End If
  47.             Else '十六進(jìn)制方式
  48.                 If Device = "C" And Val(setad) > 199 Then 'C200以上寫入
  49.                     If Val("&H" + Text2.Text) > 2847483647# Then: GoTo this
  50.                     DevDat1 = cboStation.Text + "FFWW0" + Device + "N" + DevAdd + "01" + Right("00000000" + Text2.Text, 8)
  51.                 ElseIf Device = "D" And Check1.Value = 1 Then '雙字節(jié)D寫入
  52.                     If Val("&H" + Text2.Text) > 2847483647# Then: GoTo this
  53.                     DevDat1 = Right("00000000" + Text2.Text, 8)
  54.                     DevDat1 = Right(DevDat1, 4) + Left(DevDat1, 4)
  55.                     DevDat1 = cboStation.Text + "FFWW0" + Device + DevAdd + "02" + DevDat1
  56.                 Else
  57.                     If Val("&H" + Text2.Text) > 32767 Then: GoTo this
  58.                     If Device = "D" Then '單字節(jié)D寫入
  59.                         DevDat1 = cboStation.Text + "FFWW0" + Device + DevAdd + "01" + Right("0000" + Text2.Text, 4)
  60. ……………………

  61. …………限于本文篇幅 余下代碼請下載附件…………
復(fù)制代碼
VB開發(fā)的串口與三菱FX PLC通訊源碼.rar (19.54 KB, 售價: 5 E幣)
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則

手機(jī)版|小黑屋|ELEOK |網(wǎng)站地圖

GMT+8, 2026-5-26 10:55

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回復(fù) 返回頂部 返回列表