You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

414 lines
14 KiB
Plaintext

VERSION 5.00
Object = "{40DD8EA0-284B-11D0-A7B0-0020AFF929F4}#2.2#0"; "Adsocx.ocx"
Begin VB.Form frmMaschine
BorderStyle = 1 'Fixed Single
Caption = "Beckhoff Industrie Elektronik"
ClientHeight = 3900
ClientLeft = 1155
ClientTop = 1560
ClientWidth = 6300
Icon = "frmMaschine.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
PaletteMode = 1 'UseZOrder
ScaleHeight = 3900
ScaleWidth = 6300
Begin ADSOCXLib.AdsOcx AdsOcx1
Left = 600
Top = 120
_Version = 131074
_ExtentX = 900
_ExtentY = 953
_StockProps = 0
AdsAmsServerNetId= ""
AdsAmsServerPort= 801
AdsAmsClientPort= 32782
AdsClientType = ""
AdsClientAdsState= ""
AdsClientAdsControl= ""
End
Begin VB.CommandButton prgSteps
Height = 255
Left = 120
TabIndex = 14
Top = 3360
Width = 6000
End
Begin VB.Frame fraSpeed
Caption = "Speed"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1215
Left = 4200
TabIndex = 8
Top = 1680
Width = 1935
Begin VB.OptionButton optSpeedSlow
Caption = "slow"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 240
TabIndex = 10
Top = 720
Width = 1455
End
Begin VB.OptionButton optSpeedFast
Caption = "fast"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 9
Top = 360
Width = 1335
End
End
Begin VB.Frame Frame1
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 120
TabIndex = 5
Top = 2040
Width = 3855
Begin VB.Label lblCountLabel
Caption = "Count:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 7
Top = 360
Width = 1095
End
Begin VB.Label lblCount
Caption = "lblCount"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 6
Top = 360
Width = 1455
End
End
Begin VB.Image Image1
BorderStyle = 1 'Fixed Single
Height = 255
Left = 120
Top = 3360
Width = 6015
End
Begin VB.Label lpl100Procent
Alignment = 1 'Right Justify
Caption = "100%"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 5400
TabIndex = 13
Top = 3600
Width = 735
End
Begin VB.Label lpl0Procent
Caption = "0%"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 12
Top = 3600
Width = 495
End
Begin VB.Label lplSteps
Caption = "Steps:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 11
Top = 3000
Width = 1335
End
Begin VB.Image imgLogo
BorderStyle = 1 'Fixed Single
Height = 765
Left = 4200
Picture = "frmMaschine.frx":030A
Stretch = -1 'True
Top = 720
Width = 1920
End
Begin VB.Label DeviceDown_LED
Caption = "<22>"
BeginProperty Font
Name = "Wingdings"
Size = 20.25
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 375
Left = 105
TabIndex = 4
Top = 1560
Width = 375
End
Begin VB.Label DeviceUp_LED
Caption = "<22>"
BeginProperty Font
Name = "Wingdings"
Size = 20.25
Charset = 2
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 495
Left = 120
TabIndex = 3
Top = 720
Width = 375
End
Begin VB.Label lplDeviceDown
Caption = "Device Down"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 2
Top = 1560
Width = 2175
End
Begin VB.Label lplDeviceUp
Caption = "Device Up"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 1
Top = 840
Width = 1695
End
Begin VB.Label lblMachine
Caption = "Machine"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2400
TabIndex = 0
Top = 120
Width = 1695
End
End
Attribute VB_Name = "frmMaschine"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim deviceUp As Boolean
Dim deviceDown As Boolean
Dim steps As Integer
Dim counter As Long
Dim hDeviceUp As Long
Dim hDeviceDown As Long
Dim hSteps As Long
Dim hSwitch As Long
Dim hCounter As Long
'-----------------------------------------------------
'Wird als erstes beim Starten des Programms aufgerufen
'Is activated first when the program is started
'-----------------------------------------------------
Private Sub Form_Load()
'Sprachabh<62>ngige W<>rter aus Resource-Datei laden
'load language dependent words from the resource-file
lblMachine.Caption = LoadResString(0 + GetLanguageId)
lplDeviceUp.Caption = LoadResString(1 + GetLanguageId)
lplDeviceDown.Caption = LoadResString(2 + GetLanguageId)
lblCountLabel.Caption = LoadResString(3 + GetLanguageId)
lplSteps.Caption = LoadResString(4 + GetLanguageId)
fraSpeed.Caption = LoadResString(5 + GetLanguageId)
optSpeedFast.Caption = LoadResString(6 + GetLanguageId)
optSpeedSlow.Caption = LoadResString(7 + GetLanguageId)
Me.Caption = LoadResString(8 + GetLanguageId)
'SPS-Variablen mit Visual Basic-Variablen verbinden
'Connect PLC variables with VB variables
Call AdsOcx1.AdsReadIntegerVarConnect(".steps", 2&, 4, 55, steps)
Call AdsOcx1.AdsReadBoolVarConnect(".deviceUp", 2&, 4, 55, deviceUp)
Call AdsOcx1.AdsReadBoolVarConnect(".deviceDown", 2&, 4, 55, deviceDown)
Call AdsOcx1.AdsReadLongVarConnect(".count", 4&, 4, 55, counter)
'Handle der Variablen ermitteln
'Determine handle of the variables
Call AdsOcx1.AdsCreateVarHandle(".steps", hSteps)
Call AdsOcx1.AdsCreateVarHandle(".deviceUp", hDeviceUp)
Call AdsOcx1.AdsCreateVarHandle(".deviceDown", hDeviceDown)
Call AdsOcx1.AdsCreateVarHandle(".count", hCounter)
Call AdsOcx1.AdsCreateVarHandle(".switch", hSwitch)
End Sub
'------------------------------------------
'wird beim Beenden des Programms aufgerufen
'is activated when ending the program
'------------------------------------------
Private Sub Form_Unload(Cancel As Integer)
'Visual Basic-Variablen von SPS-Variablen trennen
'Separate Visual Basic variables from PLC variables
Call AdsOcx1.AdsReadIntegerDisconnect(steps)
Call AdsOcx1.AdsReadBoolDisconnect(deviceUp)
Call AdsOcx1.AdsReadBoolDisconnect(deviceDown)
Call AdsOcx1.AdsReadLongDisconnect(counter)
'Handle der Variablen freigeben
'Release handle of the variables
Call AdsOcx1.AdsDeleteVarHandle(hSteps)
Call AdsOcx1.AdsDeleteVarHandle(hDeviceUp)
Call AdsOcx1.AdsDeleteVarHandle(hDeviceDown)
Call AdsOcx1.AdsDeleteVarHandle(hCounter)
Call AdsOcx1.AdsDeleteVarHandle(hSwitch)
End Sub
'------------------------------------------------------
'wird aufgerufen, wenn das Feld 'schnell' markiert wird
'is activated when the 'fast' field is marked
'------------------------------------------------------
Private Sub optSpeedFast_Click()
Dim switch As Boolean
'SPS-Variable switch auf TRUE setzen
'set PLC variable switch to TRUE
switch = True
Call AdsOcx1.AdsSyncWriteBoolVarReq(hSwitch, 2&, switch)
End Sub
'------------------------------------------------------
'wird aufgerufen, wenn das Feld 'langsam' markiert wird
'is activated when the 'slow' field is marked
'------------------------------------------------------
Private Sub optSpeedSlow_Click()
Dim switch As Boolean
'SPS-Variable switch auf FALSE setzen
'set PLC variable switch to FALSE
switch = False
Call AdsOcx1.AdsSyncWriteBoolVarReq(hSwitch, 2&, switch)
End Sub
'------------------------------------------------
'wird bei <20>nderung einer SPS-Variablen aufgerufen
'is activated when a PLC variable changes
'------------------------------------------------
Private Sub AdsOcx1_AdsReadConnectUpdate(ByVal nIndexGroup As Long, ByVal nIndexOffset As Long)
Select Case nIndexOffset
Case hCounter:
'St<53>ckzahl in Form anzeigen
'Display quantity in form
lblCount.Caption = counter
Case hDeviceUp
'Die Farben der Grafiken entsprechened der Variablen anpassen
'Adapt colors of graphics according to the variables
DeviceUp_LED.ForeColor = IIf(deviceUp = True, vbRed, vbWhite)
Case hDeviceDown
'Die Farben der Grafiken entsprechened der Variablen anpassen
'Adapt colors of graphics according to the variables
DeviceDown_LED.ForeColor = IIf(deviceDown = True, vbRed, vbWhite)
Case hSteps
'Position vom Werkst<73>ck anzeigen
'Display position of workpiece
prgSteps.Width = steps * 240
End Select
End Sub