ID : 5189
SysInfo
Function
Return the system information of the controller.
Syntax
SysInfo(index number)
Guaranteed entry
- Index number
- Designate an index number by integer type data.
Return value
For a variable designated by Variant Type, return Data Types data according to the index number.
Description
You can acquire the following system information.
Index number | System information | Data type |
---|---|---|
0 | Manufacturing number (serial number of the controller) | String type |
1 | MAC address of built-in network card in the controller | String type |
2 | Pendant connecting status 0 : Not connected |
Integer type |
3 | The numbers from 0 to 7 correspond to the variable types as shown below. 0 : I type |
Integer type array |
4 | CPU Information 0 : Not identified (virtual environment) |
Integer type |
5 | Login user level 1000 : Operator |
Integer type |
6 | Supervisory task status -1 : Running |
Integer type |
7 | TP panel display status -1 : Displayed |
Integer type |
8 | Total Operation | Integer type |
9 | Total Running | Integer type |
10 | Cumu.Operation | Integer type |
11 | Cumu.Running | Integer type |
12 | Operation | Integer type |
13 | Running | Integer type |
14 | MotorOn Count | Integer type |
15 | Encoder battery replacement schedule -1 : Replacement date has arrived |
Integer type |
16 | Controller battery maintenance schedule -1 : Replacement date has arrived |
Integer type |
29 | Controller type 0 : RC8 1 : RC8A |
Integer type |
30 | Safety type 0 : Standard specification 1 : Safey motion specification |
Integer type |
Index No. 6 to 16 are available in Ver.1.8.* or higher.
Index No. 29 and 30 are available in Ver.2.1.* or higher.
Related Terms
Attention
-
Example
Example 1
'!TITLE "Acquire the Manufacturing Number"
'Acquire and display the manufacturing number
Sub Sample_SysInfo
Dim aaa As Variant
'Acquire the manufacturing number
aaa = SysInfo(0)
'Display the manufacturing number in the message window
PrintDbg aaa
End Sub
Example 2
We show the example for protection that allows only the unique controller to control the program.
Follow the following procedure.
- Program creator gets a MAC address of the controller from the program user and creates a cancel code with the formula described in the program. Once the cancel code is created, let the program user know that.
- Program creator encrypts the program and sends it to program users. (For details about encryption operation, refer to "Encryption of Source Code.")
- Program users input a cancel code in the global variable "S0" to execute the program. Then, the program loads a Mac address of the controller, generates a cancel code "lic" and compares it to "S0" at the time of execution, so the process is executed when the program finds it is correct controller.
Sub Main
#pragma encrypt(on)
if IsLocked() Then Exit Sub
'Describe the process here
#pragma encrypt(off)
End Sub
#pragma encrypt(on)
Function IsLocked( ) As Integer
Dim mac As Variant
Dim lic As String
Dim key As Variant
Dim n As Integer
key = Array( &HAA, &HF5, &H55, &H3C, &H57, &H81 )
mac = split( SysInfo( 1 ), "-" ) ' X1-X2-X3-X4-X5-X6
lic = ""
For n = 0 To 5
lic = lic + Hex( Val( "&H" & mac( n ) ) Xor key( n ) )
Next
'Debug.print "LIC = " & lic & ", MAC = " & SysInfo( 1 )
If lic = S0 Then
IsLocked = False
Else
IsLocked = True
End If
End Function
#pragma encrypt(off)
ID : 5189