• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
wenluderen
人人为我我为人人
级别: 略有小成
精华主题: 0
发帖数量: 187 个
工控威望: 322 点
下载积分: 6183 分
在线时间: 43(小时)
注册时间: 2010-09-23
最后登录: 2024-02-19
查看wenluderen的 主题 / 回贴
楼主  发表于: 2018-07-23 14:32
MX Component 使用控件通讯 就可以直接PLC内部地址的名字,不要在整个标签。
标签能了很久 还是不行。


****
控件有很多






感觉三菱每个可以通讯的硬件 都有一个对应的  控制可以使用

    
本帖最近评分记录:
  • 下载积分:+5(木木2012) 感谢分享!
    030403118
    自动项目、PLC、视觉、通讯等工控软件开发QQ3515716
    级别: 工控侠客

    精华主题: 3 篇
    发帖数量: 1973 个
    工控威望: 2888 点
    下载积分: 25125 分
    在线时间: 1368(小时)
    注册时间: 2014-01-05
    最后登录: 2024-04-27
    查看030403118的 主题 / 回贴
    1楼  发表于: 2018-07-23 14:40
    项目、视觉、通讯QQ3515716
    wenluderen
    人人为我我为人人
    级别: 略有小成
    精华主题: 0
    发帖数量: 187 个
    工控威望: 322 点
    下载积分: 6183 分
    在线时间: 43(小时)
    注册时间: 2010-09-23
    最后登录: 2024-02-19
    查看wenluderen的 主题 / 回贴
    2楼  发表于: 2018-07-23 14:46
    验证通过AxActUtlTypeLib.AxActUtlType访问Q04UDV的CPU,硬件接口为以太网
    ***
    新建一个VB.net  ,窗口程序,在工具栏里面添加 控件
    如下图:

    wenluderen
    人人为我我为人人
    级别: 略有小成
    精华主题: 0
    发帖数量: 187 个
    工控威望: 322 点
    下载积分: 6183 分
    在线时间: 43(小时)
    注册时间: 2010-09-23
    最后登录: 2024-02-19
    查看wenluderen的 主题 / 回贴
    3楼  发表于: 2018-07-23 15:00
    添加OPEN 和CLOSE函数

    #Region "打开链接"
        Private Sub btn_Open_Click(sender As Object, e As EventArgs) Handles btn_Open.Click
            Dim iReturnCode As Integer              'Return code
            Dim iLogicalStationNumber As Integer    'LogicalStationNumber for ActUtlType

            ClearDisplay()

            Try
                If GetIntValue(txt_LogicalStationNumber, iLogicalStationNumber) = False Then
                    'If failed, this process is end.
                    Exit Sub
                End If
                AxActUtlType1.ActLogicalStationNumber = iLogicalStationNumber

                iReturnCode = AxActUtlType1.Open()

                If iReturnCode = 0 Then
                    'When the Open method is succeeded, disable the TextBox of 'LogocalStationNumber'.
                    txt_LogicalStationNumber.Enabled = False
                End If
            Catch exception As Exception
                MessageBox.Show(exception.Message, Name, MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub

            End Try
            txt_ReturnCode.Text = String.Format("0x{0:x8} [HEX]", iReturnCode)
        End Sub
    #End Region

    **************
    #Region "关闭链接"
        Private Sub btn_Close_Click(sender As Object, e As EventArgs) Handles btn_Close.Click
            Dim iReturnCode As Integer     'Return code
            ClearDisplay()


            Try
                iReturnCode = AxActUtlType1.Close()
                If iReturnCode = 0 Then
                    txt_LogicalStationNumber.Enabled = True
                End If

            Catch exception As Exception
                MessageBox.Show(exception.Message, Name, MessageBoxButtons.OK, MessageBoxIcon.Error)


            End Try
            txt_ReturnCode.Text = String.Format("0x{0:x8} [HEX]", iReturnCode)
        End Sub
    #End Region

    ****
    测试可以通过

    wenluderen
    人人为我我为人人
    级别: 略有小成
    精华主题: 0
    发帖数量: 187 个
    工控威望: 322 点
    下载积分: 6183 分
    在线时间: 43(小时)
    注册时间: 2010-09-23
    最后登录: 2024-02-19
    查看wenluderen的 主题 / 回贴
    4楼  发表于: 2018-07-23 15:05
    随机读取

    #Region "随机写入 PLC里面的地址"
        Private Sub btn_ReadDeviceRandom2_Click(sender As Object, e As EventArgs) Handles btn_ReadDeviceRandom2.Click
            Dim iReturnCode As Integer              'Return code
            Dim szDeviceName As String = ""         'List data for 'DeviceName'
            Dim iNumberOfDeviceName As Integer = 0  'Data for 'DeviceSize'
            Dim sharrDeviceValue() As Short         'Data for 'DeviceValue'
            Dim szarrData() As String               'Array for 'Data'
            Dim iNumber As Integer                  'Loop counter

            'Displayed output data is cleared.
            ClearDisplay()

            'Get the list of 'DeviceName'.
            '  Join each line(StringType array) of 'DeviceName' by the separator '\n',
            '  and create a joined string data.
            szDeviceName = String.Join(vbLf, txt_DeviceNameRandom.Lines)

            If GetIntValue(txt_DeviceSizeRandom, iNumberOfDeviceName) = False Then
                'If failed, this process is end.
                Exit Sub
            End If

            ReDim sharrDeviceValue(iNumberOfDeviceName - 1)

            Try
                iReturnCode = AxActUtlType1.ReadDeviceRandom2(szDeviceName,  iNumberOfDeviceName, sharrDeviceValue(0))
            Catch exException As Exception
                MessageBox.Show(exException.Message, Name, MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub
            End Try
            txt_ReturnCode.Text = String.Format("0x{0:x8} [HEX]", iReturnCode)

            If iReturnCode = 0 Then

                'Assign the array for the read data.
                ReDim szarrData(iNumberOfDeviceName - 1)

                'Copy the read data to the 'lpszarrData'.
                For iNumber = 0 To iNumberOfDeviceName - 1
                    szarrData(iNumber) = sharrDeviceValue(iNumber).ToString()
                Next iNumber

                'Set the read data to the 'Data', and display it.
                txt_Data.Lines = szarrData
            End If

        End Sub

    #End Region


      
    wenluderen
    人人为我我为人人
    级别: 略有小成
    精华主题: 0
    发帖数量: 187 个
    工控威望: 322 点
    下载积分: 6183 分
    在线时间: 43(小时)
    注册时间: 2010-09-23
    最后登录: 2024-02-19
    查看wenluderen的 主题 / 回贴
    5楼  发表于: 2018-07-23 15:09
    测试随机写入
    #Region "随机写入 PLC里面的地址"
        Private Sub btn_WriteDeviceRandom2_Click(sender As Object, e As EventArgs) Handles btn_WriteDeviceRandom2.Click

            Dim iReturnCode As Integer              'Return code
            Dim szDeviceName As String = ""         'List data for 'DeviceName'
            Dim iNumberOfDeviceName As Integer = 0  'Data for 'DeviceSize'
            Dim sharrDeviceValue() As Short         'Data for 'DeviceValue'

            'Displayed output data is cleared.
            ClearDisplay()

            'Get the list of 'DeviceName'.
            'Join each line(StringType array) of 'DeviceName' by the separator '\n',
            'and create a joined string data.
            szDeviceName = String.Join(vbLf, txt_DeviceNameRandom.Lines)

            'Check the 'DeviceSize'.(If succeeded, the value is gotten.)
            If GetIntValue(txt_DeviceSizeRandom, iNumberOfDeviceName) = False Then
                'If failed, this process is end.
                Exit Sub
            End If

            'Check the 'DeviceValue'.(If succeeded, the value is gotten.)
            ReDim sharrDeviceValue(iNumberOfDeviceName - 1)
            If GetShortArray(txt_DeviceDataRandom, sharrDeviceValue) = False Then
                'If failed, this process is end.
                Exit Sub
            End If

            Try
                iReturnCode = AxActUtlType1.WriteDeviceRandom2(szDeviceName, iNumberOfDeviceName, sharrDeviceValue(0))
            Catch exception As Exception

                MessageBox.Show(exception.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub

            End Try
            txt_ReturnCode.Text = String.Format("0x{0:x8} [HEX]", iReturnCode)


        End Sub
    #End Region

    wenluderen
    人人为我我为人人
    级别: 略有小成
    精华主题: 0
    发帖数量: 187 个
    工控威望: 322 点
    下载积分: 6183 分
    在线时间: 43(小时)
    注册时间: 2010-09-23
    最后登录: 2024-02-19
    查看wenluderen的 主题 / 回贴
    6楼  发表于: 2018-07-23 15:24
    测试成块的数据读取
    #Region "测试成块的数据读取"
        Private Sub btn_ReadDeviceBlock2_Click(sender As Object, e As EventArgs) Handles btn_ReadDeviceBlock2.Click

          Dim iReturnCode As Integer              'Return code
            Dim szDeviceName As String = ""         'List data for 'DeviceName'
            Dim iNumberOfDeviceName As Integer = 0  'Data for 'DeviceSize'
            Dim sharrDeviceValue() As Short         'Data for 'DeviceValue'
            Dim szarrData() As String               'Array for 'Data'
            Dim iNumber As Integer                  'Loop counter


            'Displayed output data is cleared.
            ClearDisplay()

            'Get the list of 'DeviceName'.
            '  Join each line(StringType array) of 'DeviceName' by the separator '\n',
            '  and create a joined string data.
            szDeviceName = String.Join(vbLf, txt_DeviceNameBlock.Lines)

            'Check the 'DeviceSize'.(If succeeded, the value is gotten.)
            If GetIntValue(txt_DeviceSizeBlock, iNumberOfDeviceName) = False Then
                'If failed, this process is end.
                Exit Sub
            End If

            'Assign the array for 'DeviceValue'.
            ReDim sharrDeviceValue(iNumberOfDeviceName - 1)

            Try
                iReturnCode = AxActUtlType1.ReadDeviceBlock2(szDeviceName, iNumberOfDeviceName, sharrDeviceValue(0))
            Catch exException As Exception
                MessageBox.Show(exException.Message, Name, MessageBoxButtons.OK, MessageBoxIcon.Error)
                Exit Sub
            End Try


            txt_ReturnCode.Text = String.Format("0x{0:x8} [HEX]", iReturnCode)
            If iReturnCode = 0 Then

                'Assign array for the read data.
                ReDim szarrData(iNumberOfDeviceName - 1)

                'Copy the read data to the 'lpszarrData'.
                For iNumber = 0 To iNumberOfDeviceName - 1
                    szarrData(iNumber) = sharrDeviceValue(iNumber).ToString()
                Next iNumber

                'Set the read data to the 'Data', and display it.
                txt_Data.Lines = szarrData
            End If


        End Sub
    #End Region


    030403118
    自动项目、PLC、视觉、通讯等工控软件开发QQ3515716
    级别: 工控侠客

    精华主题: 3 篇
    发帖数量: 1973 个
    工控威望: 2888 点
    下载积分: 25125 分
    在线时间: 1368(小时)
    注册时间: 2014-01-05
    最后登录: 2024-04-27
    查看030403118的 主题 / 回贴
    7楼  发表于: 2018-07-23 18:37
    项目、视觉、通讯QQ3515716
    nlb2001
    级别: 略有小成
    精华主题: 0
    发帖数量: 96 个
    工控威望: 237 点
    下载积分: 577 分
    在线时间: 64(小时)
    注册时间: 2013-02-03
    最后登录: 2024-03-26
    查看nlb2001的 主题 / 回贴
    8楼  发表于: 2018-08-03 11:19
    神级操作,先收藏了!!
    zq362622701
    级别: 略有小成
    精华主题: 0
    发帖数量: 43 个
    工控威望: 266 点
    下载积分: 2067 分
    在线时间: 52(小时)
    注册时间: 2012-12-21
    最后登录: 2024-04-06
    查看zq362622701的 主题 / 回贴
    9楼  发表于: 2018-08-09 10:57
    现在都在搞上位机了
    zjh0102
    级别: 论坛先锋
    精华主题: 0
    发帖数量: 59 个
    工控威望: 1259 点
    下载积分: 1782 分
    在线时间: 102(小时)
    注册时间: 2018-01-27
    最后登录: 2022-03-09
    查看zjh0102的 主题 / 回贴
    10楼  发表于: 2019-01-22 10:18
    想看C#的
    cd_looper
    好想放飞自我
    级别: 工控侠客
    精华主题: 0
    发帖数量: 364 个
    工控威望: 2011 点
    下载积分: 3366 分
    在线时间: 224(小时)
    注册时间: 2013-11-16
    最后登录: 2024-03-23
    查看cd_looper的 主题 / 回贴
    11楼  发表于: 2019-01-22 11:07
    想看Labview的  
    Easy doesn't enter into grown-up life!!!
    V:ZQL276438265
    • «
    • 1
    • 2
    • »
    • Pages: 1/2     Go