⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 工控硬件读写ISA多功能卡823的VB例子程序
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   12
         Left            =   1776
         Shape           =   3  'Circle
         Top             =   1296
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   11
         Left            =   1416
         Shape           =   3  'Circle
         Top             =   1296
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   10
         Left            =   1056
         Shape           =   3  'Circle
         Top             =   1296
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   9
         Left            =   696
         Shape           =   3  'Circle
         Top             =   1296
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   8
         Left            =   336
         Shape           =   3  'Circle
         Top             =   1296
         Width           =   252
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H0080FFFF&
         Caption         =   "0        1        2       3        4        5        6        7"
         Height          =   192
         Index           =   0
         Left            =   336
         TabIndex        =   2
         Top             =   360
         Width           =   2652
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   7
         Left            =   2820
         Shape           =   3  'Circle
         Top             =   636
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   6
         Left            =   2460
         Shape           =   3  'Circle
         Top             =   636
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   5
         Left            =   2100
         Shape           =   3  'Circle
         Top             =   636
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   3
         Left            =   1380
         Shape           =   3  'Circle
         Top             =   636
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   2
         Left            =   1020
         Shape           =   3  'Circle
         Top             =   636
         Width           =   252
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H0080FFFF&
         Caption         =   "8        9        A       B       C       D        E      F"
         Height          =   192
         Index           =   2
         Left            =   360
         TabIndex        =   1
         Top             =   996
         Width           =   2652
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   29
         Left            =   960
         Shape           =   3  'Circle
         Top             =   600
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   28
         Left            =   1320
         Shape           =   3  'Circle
         Top             =   600
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   4
         Left            =   1740
         Shape           =   3  'Circle
         Top             =   636
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   26
         Left            =   2040
         Shape           =   3  'Circle
         Top             =   600
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   27
         Left            =   1680
         Shape           =   3  'Circle
         Top             =   600
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   25
         Left            =   2400
         Shape           =   3  'Circle
         Top             =   600
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   24
         Left            =   2760
         Shape           =   3  'Circle
         Top             =   600
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   16
         Left            =   2808
         Shape           =   3  'Circle
         Top             =   1260
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   17
         Left            =   2448
         Shape           =   3  'Circle
         Top             =   1260
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   18
         Left            =   2088
         Shape           =   3  'Circle
         Top             =   1260
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   19
         Left            =   1728
         Shape           =   3  'Circle
         Top             =   1260
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   20
         Left            =   1368
         Shape           =   3  'Circle
         Top             =   1260
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   21
         Left            =   1008
         Shape           =   3  'Circle
         Top             =   1260
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   22
         Left            =   648
         Shape           =   3  'Circle
         Top             =   1260
         Width           =   252
      End
      Begin VB.Shape DI_Shape 
         BorderColor     =   &H00000000&
         FillColor       =   &H00808080&
         FillStyle       =   0  'Solid
         Height          =   252
         Index           =   23
         Left            =   288
         Shape           =   3  'Circle
         Top             =   1260
         Width           =   252
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim wRtn As Integer, wTotalBoards As Integer

Private Sub Command1_Click()
    A823_DriverClose
    Timer1.Enabled = False
    End
End Sub

Private Sub Command2_Click()
    If Command2.Caption = "Active" Then
        If A823_ActiveBoard(Val(eSelect.Text)) <> A823_NoError Then
            MsgBox "Can not Active the Board."
            Exit Sub
        End If
        
        vDI_Click 1
        vDI_Click 1
        Command2.Caption = "Stop"
        Timer1.Enabled = True
        Command1.Enabled = False
        Frame1.Enabled = True
    Else
        Command2.Caption = "Active"
        Timer1.Enabled = False
        Command1.Enabled = True
        Frame1.Enabled = False
    End If
End Sub

Private Sub Form_Load()
    Dim rtn
    Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
    
    '********************************************************************
    '* NOTICE: call A823_DriverInit() to initialize the driver.        *
    '* Initial the device driver, and return the board number in the PC *
    '********************************************************************
    Frame1.Enabled = False
    Command2.Caption = "Active"
    Command2.Enabled = False
    
    wRtn = A823_DriverInit(wTotalBoards)
    If wRtn <> A823_NoError Then
        MsgBox "Driver Open Error !!!"
        Exit Sub
    End If
    
    If wTotalBoards < 1 Then
        MsgBox "Card Not Found!!"
        Exit Sub
    End If
    
    eTotal.Text = Str(wTotalBoards)
    Command2.Enabled = True
   
End Sub

Private Sub Timer1_Timer()
    Dim i%, J%
    
    wRtn = A823_DI(J)
    For i = 0 To 15
        DI_Shape(i).FillColor = IIf(J And 2 ^ i, RGB(255, 0, 0), RGB(0, 0, 0))
    Next i
End Sub

Private Sub vDI_Click(Index As Integer)
    Dim i%, rtn
    Dim J As Long
  
    J = 0
    For i = 0 To 15
        If vDI(i).Value Then J = J Or 2 ^ i
    Next i
    A823_DO CInt("&H" & Hex(J))
End Sub

⌨️ 快捷键说明

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