EasyManua.ls Logo

Atlas Copco PowerMACS 4000

Atlas Copco PowerMACS 4000
668 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Peripheral Devices
594 9836 3521 01
Setting a Boolean value in the target system
This example assumes that there are textboxes for address and value, and a dropdown list for the bit
value.
Private Sub cmdSetBool_Click()
'
' Abstract: Set PLC Bool from API-server and display it
'
On Error GoTo ErrorHandler
Dim Ret As RetCodeEnum
Dim Address As Integer
Dim Value As Boolean
If Val(txtAddress) < 1 Or Val(txtAddress) > 999 Then
MsgBox "Address must be between 1 and 999"
txtAddress.SetFocus
Exit Sub
End If
Address = CInt(txtAddress)
Value = CBool(txtValue)
Ret = mPowApi.SetPLCBool(Address, Val(cboBit), Value)
if Ret <> eRetOk then msgBox "SetPLCBool returned: " & Ret
Exit Sub
ErrorHandler:
If Err.Number = 13 Then
MsgBox "Value must be a valid boolean"
txtAddress.SetFocus
Exit Sub
End If
MsgBox err.description
exit sub
End Sub

Table of Contents

Related product manuals