- Private Sub Text1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
- lblTopic = "输入要监控或设置的地址回车确定,如D0,T10,Y7等"
- End Sub
- Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
- If KeyCode <> 13 Then
- start = False
- End If
- End Sub
- Private Sub Text2_KeyPress(KeyAscii As Integer)
- char = Chr(KeyAscii)
- KeyAscii = Asc(UCase(char))
- If Device = "D" And CStr(Val(setad)) = setad And Val(setad) < 1000 Then
- start = False
- End If
- If (Device = "T" Or Device = "C") And CStr(Val(setad)) = setad And Val(setad) < 256 Then
- start = False
- End If
- If KeyAscii = 13 Then
- If Val(DevAdd) > 7999 Then
- If MsgBox("改变系统参数可能对系统造成破坏,是否写入?", vbOKCancel + vbCritical) = vbCancel Then Exit Sub
- ElseIf MsgBox("改变当前值可能对运行造成危险,是否写入?", vbOKCancel + vbExclamation) = vbCancel Then Exit Sub
- End If
- If Device = "D" And Check1.Value = 0 Then
- DevAdd = Right(("0000" + setad), 4)
- ElseIf Device = "D" And Check1.Value = 1 Then
- DevAdd = Right(("0000" + setad), 4)
- Else
- DevAdd = Right(("000" + setad), 3)
- End If
- If OptionD.Value Then '十进制方式
- If Device = "C" And Val(setad) > 199 Then 'C200以上写入
- If Val(Text2.Text) > 2847483647# Then: GoTo this
- DevDat1 = cboStation.Text + "FFWW0" + Device + "N" + DevAdd + "01" + Right("00000000" + Hex(Val(Text2.Text)), 8)
- ElseIf Device = "D" And Check1.Value = 1 Then '双字节D写入
- If Val(Text2.Text) > 2847483647# Then: GoTo this
- DevDat1 = Right("00000000" + Hex(Val(Text2.Text)), 8)
- DevDat1 = Right(DevDat1, 4) + Left(DevDat1, 4)
- DevDat1 = cboStation.Text + "FFWW0" + Device + DevAdd + "02" + DevDat1
- Else
- If Val(Text2.Text) > 32767 Then: GoTo this
- If Device = "D" Then '单字节D写入
- DevDat1 = cboStation.Text + "FFWW0" + Device + DevAdd + "01" + Right("0000" + Hex(Val(Text2.Text)), 4)
- Else 'C200以下写入
- DevDat1 = cboStation.Text + "FFWW0" + Device + "N" + DevAdd + "01" + Right("0000" + Hex(Val(Text2.Text)), 4)
- End If
- End If
- Else '十六进制方式
- If Device = "C" And Val(setad) > 199 Then 'C200以上写入
- If Val("&H" + Text2.Text) > 2847483647# Then: GoTo this
- DevDat1 = cboStation.Text + "FFWW0" + Device + "N" + DevAdd + "01" + Right("00000000" + Text2.Text, 8)
- ElseIf Device = "D" And Check1.Value = 1 Then '双字节D写入
- If Val("&H" + Text2.Text) > 2847483647# Then: GoTo this
- DevDat1 = Right("00000000" + Text2.Text, 8)
- DevDat1 = Right(DevDat1, 4) + Left(DevDat1, 4)
- DevDat1 = cboStation.Text + "FFWW0" + Device + DevAdd + "02" + DevDat1
- Else
- If Val("&H" + Text2.Text) > 32767 Then: GoTo this
- If Device = "D" Then '单字节D写入
- DevDat1 = cboStation.Text + "FFWW0" + Device + DevAdd + "01" + Right("0000" + Text2.Text, 4)
- ……………………
- …………限于本文篇幅 余下代码请下载附件…………
复制代码
VB开发的串口与三菱FX PLC通讯源码.rar
(19.54 KB, 售价: 5 E币)
【必读】版权免责声明
1、本主题所有言论和内容纯属会员个人意见,与本论坛立场无关。2、本站对所发内容真实性、客观性、可用性不做任何保证也不负任何责任,网友之间仅出于学习目的进行交流。3、对提供的数字内容不拥有任何权利,其版权归原著者拥有。请勿将该数字内容进行商业交易、转载等行为,该内容只为学习所提供,使用后发生的一切问题与本站无关。 4、本网站不保证本站提供的下载资源的准确性、安全性和完整性;同时本网站也不承担用户因使用这些下载资源对自己和他人造成任何形式的损失或伤害。 5、本网站所有软件和资料均为网友推荐收集整理而来,仅供学习用途使用,请务必下载后两小时内删除,禁止商用。6、如有侵犯你版权的,请及时联系我们(电子邮箱1370723259@qq.com)指出,本站将立即改正。
|