exampleslave.bas

来自「PLC相关-656M.zip」· BAS 代码 · 共 43 行

BAS
43
字号
Attribute VB_Name = "ExampleSlave"
Option Explicit


Public Sub AllSlaveData(Sla As S7Slave)
Dim str As String

On Error Resume Next
    str = "Name: " & Sla.Name & Chr(13) & _
        "Logical Path: " & Sla.LogPath & Chr(13) & _
        "MLFB: " & Sla.MLFB & Chr(13) & _
        "Index: " & Sla.Index & Chr(13) & _
        "PROFIBUSAddress: " & Sla.PROFIBUSAddress & Chr(13)
    If CatchError Then Exit Sub

    str = str & "Anzahl LocalInAddresses: "
    str = str & Sla.LocalInAddresses.count & Chr(13)
    If CatchError(False) Then
        str = str & "Nothing" & Chr(13)
    End If
    
    str = str & "Anzahl Modules: " & Sla.Modules.count & Chr(13)
    
    str = str & "Anzahl TerminalBlocks: " & Sla.TerminalBlocks.count & Chr(13)
    If CatchError(False) Then
        str = str & "Anzahl TerminalBlocks: Nothing" & Chr(13)
    End If
            
    MsgBox str, vbInformation, "Daten des Slaves " & Sla.Name
End Sub


Public Sub ExampleSlave1()
    Dim SubS As S7SubSystem
    Dim Sla As S7Slave
    Dim dlg As New AttributesDlg
    
    ' Ermittle das SubSystem 1 der Station "relativity"
On Error Resume Next
    Set SubS = S.Projects("reptiles").Stations("relativity").SubSystems(1)
    If CatchError Then
        MsgBox "Es wird das Project 'Reptiles' und die Station " _
            & "'Relativity' benoetigt. Au遝rdem mu

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?