标题:请问各位高手,下面这段程序什么意思,
只看楼主
dhp
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2014-6-13
 问题点数:0 回复次数:4 
请问各位高手,下面这段程序什么意思,
ElseIf RPLC1 Then
        RPLC1 = False: ParameterForm.OverTimer.Enabled = False
        If RBin(0) = &H2 And LRBin >= 812 Then
            For i = 1 To 809
                sum = sum + CLng(RBin(i))
            Next i
            j = 0
            If sum Mod 256 = AscToLng(RBin(810)) * 16 + AscToLng(RBin(811)) Then
                For i = 0 To 14
                    DataBuffer(i) = DataConvert(AscToLng(RBin(j + 5)), AscToLng(RBin(j + 6)), AscToLng(RBin(j + 7)), AscToLng(RBin(j + 8)))
                    j = j + 4
                Next i
                SendCmd = Chr(5) & "00FFWR0D1000C94B"
                If InfoScroll Then
                    InfoList.Text = InfoList.Text & "TXD: " & SendCmd & vbCrLf
                    InfoList.SelStart = Len(InfoList.Text) - 1
                End If
                MSComm1.Output = SendCmd
                RPLC2 = True
                ParameterForm.OverTimer.Enabled = True
            Else
                MsgBox "参数从PLC读取错误!", vbExclamation, "参数设置"
                ParameterForm.ReadfromPLC.Enabled = True: ParameterForm.WritetoPLC.Enabled = True
            End If
        Else
            MsgBox "参数从PLC读取错误!", vbExclamation, "参数设置"
            ParameterForm.ReadfromPLC.Enabled = True: ParameterForm.WritetoPLC.Enabled = True
        End If
搜索更多相关主题的帖子: False 
2014-06-13 14:08
dhp
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2014-6-13
得分:0 
这是一段把三菱FX-3U数据存储区的内容读出到VB做的一个表里,哪位高手给讲解一下,不胜感激
2014-06-13 14:23
dhp
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2014-6-13
得分:0 
ElseIf RPLC1 Then
        RPLC1 = False: ParameterForm.OverTimer.Enabled = False
        If RBin(0) = &H2 And LRBin >= 68 Then
            For i = 1 To 65
                sum = sum + CLng(RBin(i))
            Next i
            j = 0
            If sum Mod 256 = AscToLng(RBin(66)) * 16 + AscToLng(RBin(67)) Then
                For i = 0 To 14
                    DataBuffer(i) = DataConvert(AscToLng(RBin(j + 5)), AscToLng(RBin(j + 6)), AscToLng(RBin(j + 7)), AscToLng(RBin(j + 8)))
                    j = j + 4
                Next i
                SendCmd = Chr(5) & "00FFWR0D1000402E"
                If InfoScroll Then
                    InfoList.Text = InfoList.Text & "TXD: " & SendCmd & vbCrLf
                    InfoList.SelStart = Len(InfoList.Text) - 1
                End If
                MSComm1.Output = SendCmd
                RPLC2 = True
                ParameterForm.OverTimer.Enabled = True
            Else
                MsgBox "参数从PLC读取错误!", vbExclamation, "参数设置"
                ParameterForm.ReadfromPLC.Enabled = True: ParameterForm.WritetoPLC.Enabled = True
            End If
        Else
            MsgBox "参数从PLC读取错误!", vbExclamation, "参数设置"
            ParameterForm.ReadfromPLC.Enabled = True: ParameterForm.WritetoPLC.Enabled = True
        End If
这个是原来的
2014-06-13 14:25
dhp
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2014-6-13
得分:0 
哪位高手给解释一下这段就行  
        If RBin(0) = &H2 And LRBin >= 68 Then
            For i = 1 To 65
                sum = sum + CLng(RBin(i))
            Next i
            j = 0
            If sum Mod 256 = AscToLng(RBin(66)) * 16 + AscToLng(RBin(67)) Then
                For i = 0 To 14
                    DataBuffer(i) = DataConvert(AscToLng(RBin(j + 5)), AscToLng(RBin(j + 6)), AscToLng(RBin(j + 7)), AscToLng(RBin(j + 8)))
                    j = j + 4
                Next i
2014-06-13 14:54
chen3523
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:33
帖 子:223
专家分:1165
注 册:2013-2-12
得分:0 
你提出的问题太专业了,从中间拿一段出来,不让人知道公式或模型,回复吃力。

调试失败3次后,关机睡觉,当醒来时多有收获。
2014-06-14 15:45



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-432882-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.732024 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved