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

📄 do.frm

📁 利用DAQDO控件实现板卡数字量输出试过好用
💻 FRM
字号:
VERSION 5.00
Object = "{DD19B926-A6A4-11D2-AA04-002018650913}#1.1#0"; "Addout.ocx"
Begin VB.Form DAQForm 
   BackColor       =   &H00E0E0E0&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "数字量输出"
   ClientHeight    =   2655
   ClientLeft      =   870
   ClientTop       =   945
   ClientWidth     =   4650
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2655
   ScaleWidth      =   4650
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Cmdclose 
      Caption         =   "关闭指示灯"
      Height          =   375
      Left            =   3195
      TabIndex        =   4
      Top             =   930
      Width           =   1140
   End
   Begin VB.CommandButton Cmdopen 
      Caption         =   "打开指示灯"
      Height          =   375
      Left            =   3195
      TabIndex        =   3
      Top             =   315
      Width           =   1140
   End
   Begin VB.Frame Frame2 
      Caption         =   "控制指示"
      Height          =   2265
      Left            =   180
      TabIndex        =   2
      Top             =   210
      Width           =   2580
      Begin VB.TextBox Text2 
         Height          =   345
         Left            =   1440
         TabIndex        =   9
         Top             =   1740
         Width           =   855
      End
      Begin VB.TextBox Text1 
         Height          =   345
         Left            =   1440
         TabIndex        =   8
         Top             =   1200
         Width           =   855
      End
      Begin VB.Label Label3 
         Caption         =   "关闭次数:"
         Height          =   285
         Left            =   240
         TabIndex        =   7
         Top             =   1830
         Width           =   1005
      End
      Begin VB.Label Label2 
         Caption         =   "打开次数:"
         Height          =   285
         Left            =   240
         TabIndex        =   6
         Top             =   1290
         Width           =   1005
      End
      Begin VB.Label Label1 
         Caption         =   "信号指示灯:"
         Height          =   285
         Left            =   240
         TabIndex        =   5
         Top             =   570
         Width           =   1215
      End
      Begin VB.Shape alarm 
         BackColor       =   &H00FFFFFF&
         BorderColor     =   &H00404040&
         FillColor       =   &H0080FF80&
         FillStyle       =   0  'Solid
         Height          =   675
         Left            =   1530
         Shape           =   2  'Oval
         Top             =   270
         Width           =   645
      End
   End
   Begin VB.CommandButton Cmdquit 
      Caption         =   "关闭程序"
      Height          =   375
      Left            =   3195
      TabIndex        =   1
      Top             =   1560
      Width           =   1140
   End
   Begin DAQDOLib.DAQDO DAQDO1 
      Height          =   495
      Left            =   3540
      TabIndex        =   0
      Top             =   2010
      Width           =   495
      _Version        =   65537
      _ExtentX        =   864
      _ExtentY        =   864
      _StockProps     =   0
      MaxPortNumber   =   0
   End
End
Attribute VB_Name = "DAQForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'定义变量
 Dim num1 As Integer                           '打开次数
 Dim num2 As Integer                           '关闭次数
 Dim zt As Integer                             '开关状态
'程序初始化
Private Sub Form_Load()
  DAQDO1.SelectDevice                         '选择数字量输出设备
  DAQDO1.OpenDevice                           '打开数字量输出端口
  alarm.FillColor = QBColor(10)               '报警指示灯初始颜色
  zt = 1
End Sub
'打开指示灯
Private Sub Cmdopen_Click()
  If zt = 1 Then
    alarm.FillColor = QBColor(12)
    DAQDO1.Bit = 1
    DAQDO1.BitOutput (1)
    num1 = num1 + 1
    Text1.Text = Str(num1)
    zt = 2
  End If
End Sub
'关闭指示灯
Private Sub Cmdclose_Click()
  If zt = 2 Then
    alarm.FillColor = QBColor(10)
    DAQDO1.Bit = 1
    DAQDO1.BitOutput (0)
    num2 = num2 + 1
    Text2.Text = Str(num2)
    zt = 1
  End If
End Sub
'关闭程序
Private Sub Cmdquit_Click()
  DAQDO1.CloseDevice                          '关闭板卡数字量输出端口
  Unload Me
End Sub

⌨️ 快捷键说明

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