sccfg.frm

来自「16 relay output channels and 16 isolated」· FRM 代码 · 共 392 行

FRM
392
字号
VERSION 5.00
Begin VB.Form fSCConfig 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Advantech 1753 Demo: Status Change configuration"
   ClientHeight    =   2100
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5790
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2100
   ScaleWidth      =   5790
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdCancel 
      Caption         =   "&Cancel"
      Height          =   435
      Left            =   4620
      TabIndex        =   37
      Top             =   945
      Width           =   960
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "&OK"
      Height          =   435
      Left            =   4620
      TabIndex        =   36
      Top             =   315
      Width           =   960
   End
   Begin VB.Frame Frame2 
      Caption         =   "Port B0"
      Height          =   855
      Left            =   105
      TabIndex        =   18
      Top             =   1050
      Width           =   4320
      Begin VB.CheckBox chkEnablePB4 
         Height          =   225
         Index           =   0
         Left            =   945
         TabIndex        =   26
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB4 
         Height          =   225
         Index           =   1
         Left            =   1365
         TabIndex        =   25
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB4 
         Height          =   225
         Index           =   2
         Left            =   1785
         TabIndex        =   24
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB4 
         Height          =   225
         Index           =   3
         Left            =   2205
         TabIndex        =   23
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB4 
         Height          =   225
         Index           =   4
         Left            =   2625
         TabIndex        =   22
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB4 
         Height          =   225
         Index           =   5
         Left            =   3045
         TabIndex        =   21
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB4 
         Height          =   225
         Index           =   6
         Left            =   3465
         TabIndex        =   20
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB4 
         Height          =   225
         Index           =   7
         Left            =   3885
         TabIndex        =   19
         Top             =   525
         Width           =   225
      End
      Begin VB.Label Label3 
         Caption         =   "Enable"
         Height          =   225
         Left            =   105
         TabIndex        =   35
         Top             =   525
         Width           =   645
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   15
         Left            =   945
         TabIndex        =   34
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   14
         Left            =   1365
         TabIndex        =   33
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   13
         Left            =   1785
         TabIndex        =   32
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   12
         Left            =   2205
         TabIndex        =   31
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   11
         Left            =   2625
         TabIndex        =   30
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   10
         Left            =   3045
         TabIndex        =   29
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   9
         Left            =   3465
         TabIndex        =   28
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   8
         Left            =   3885
         TabIndex        =   27
         Top             =   210
         Width           =   330
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "Port B0"
      Height          =   855
      Left            =   105
      TabIndex        =   0
      Top             =   105
      Width           =   4320
      Begin VB.CheckBox chkEnablePB0 
         Height          =   225
         Index           =   7
         Left            =   3885
         TabIndex        =   17
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB0 
         Height          =   225
         Index           =   6
         Left            =   3465
         TabIndex        =   16
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB0 
         Height          =   225
         Index           =   5
         Left            =   3045
         TabIndex        =   15
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB0 
         Height          =   225
         Index           =   4
         Left            =   2625
         TabIndex        =   14
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB0 
         Height          =   225
         Index           =   3
         Left            =   2205
         TabIndex        =   13
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB0 
         Height          =   225
         Index           =   2
         Left            =   1785
         TabIndex        =   12
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB0 
         Height          =   225
         Index           =   1
         Left            =   1365
         TabIndex        =   11
         Top             =   525
         Width           =   225
      End
      Begin VB.CheckBox chkEnablePB0 
         Height          =   225
         Index           =   0
         Left            =   945
         TabIndex        =   10
         Top             =   525
         Width           =   225
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   7
         Left            =   3885
         TabIndex        =   9
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   6
         Left            =   3465
         TabIndex        =   8
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   5
         Left            =   3045
         TabIndex        =   7
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   4
         Left            =   2625
         TabIndex        =   6
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   3
         Left            =   2205
         TabIndex        =   5
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   2
         Left            =   1785
         TabIndex        =   4
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   1
         Left            =   1365
         TabIndex        =   3
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label2 
         Caption         =   "Bit0"
         Height          =   225
         Index           =   0
         Left            =   945
         TabIndex        =   2
         Top             =   210
         Width           =   330
      End
      Begin VB.Label Label1 
         Caption         =   "Enable"
         Height          =   225
         Left            =   105
         TabIndex        =   1
         Top             =   525
         Width           =   645
      End
   End
End
Attribute VB_Name = "fSCConfig"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public giPB0Value As Integer
Public giPB4Value As Integer

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOk_Click()
Dim i As Integer
Dim iValue As Integer
    
    'Store configuration to a value
    'Port B0 value
    iValue = 0
    For i = 7 To 0 Step -1
        iValue = iValue * 2 + chkEnablePB0(i).Value
    Next i
    giPB0Value = iValue
    
    'Port B4 value
    iValue = 0
    For i = 7 To 0 Step -1
        iValue = iValue * 2 + chkEnablePB4(i).Value
    Next i
    giPB4Value = iValue
    
    Unload Me
End Sub

Private Sub Form_Activate()
Dim i As Integer
Dim iValue As Integer

    'Default value for Port B 0 configuration
    iValue = giPB0Value
    For i = 0 To 7
        chkEnablePB0(i).Value = (iValue And 1)
        iValue = iValue \ 2
    Next i
    
    'Default value for Port B 4 configuration
    iValue = giPB4Value
    For i = 0 To 7
        chkEnablePB4(i).Value = (iValue And 1)
        iValue = iValue \ 2
    Next i
    
End Sub

⌨️ 快捷键说明

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