?? cnt.frm
字號(hào):
VERSION 5.00
Begin VB.Form CNT
BorderStyle = 1 'Fixed Single
Caption = "PCI8613_CNT"
ClientHeight = 2595
ClientLeft = 45
ClientTop = 435
ClientWidth = 5895
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2595
ScaleWidth = 5895
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 1000
Left = 5040
Top = 1920
End
Begin VB.CommandButton Command1
Caption = "停止"
Enabled = 0 'False
Height = 375
Left = 3240
TabIndex = 3
Top = 1560
Width = 1335
End
Begin VB.CommandButton Command_GetVal
Caption = "開(kāi)始"
Height = 375
Left = 1320
TabIndex = 2
Top = 1560
Width = 1335
End
Begin VB.TextBox TextCNTVal
Enabled = 0 'False
Height = 270
Left = 2760
TabIndex = 1
Top = 840
Width = 855
End
Begin VB.Label Label1
Caption = "CNTVal ="
Height = 255
Left = 1800
TabIndex = 0
Top = 840
Width = 855
End
End
Attribute VB_Name = "CNT"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim hDevice As Long
Dim DeviceLgcID As Integer
Dim iCNTChannel As Integer
Dim CNTPara As PCI8613_PARA_CNT ' 硬件參數(shù)
Private Sub Command_GetVal_Click()
DeviceLgcID = 0
hDevice = PCI8613_CreateDevice(DeviceLgcID) ' 創(chuàng)建設(shè)備對(duì)象
If hDevice = INVALID_HANDLE_VALUE Then
MsgBox "創(chuàng)建設(shè)備出錯(cuò)"
Me.Command_GetVal.Enabled = False
Exit Sub
End If
iCNTChannel = 0
' 預(yù)置硬件參數(shù)
CNTPara.CNTVal = 100
CNTPara.AddDecMode = 0
CNTPara.ControlMode = 0
If (PCI8613_SetDeviceCNT(hDevice, CNTPara, iCNTChannel) = False) Then ' 初始化硬件
MsgBox ("InitDeviceCNT error")
Call Command1_Click
End If
Me.Command_GetVal.Enabled = False
Me.Command1.Enabled = True
Me.Timer1.Enabled = True
End Sub
Private Sub Command1_Click()
If hDevice <> INVALID_HANDLE_VALUE Then
If PCI8613_ReleaseDevice(hDevice) = False Then ' 釋放設(shè)備對(duì)象
MsgBox "PCI8613_ReleaseDevice Error..."
Else
hDevice = INVALID_HANDLE_VALUE
End If
End If
Me.Command_GetVal.Enabled = True
Me.Command1.Enabled = False
Me.Timer1.Enabled = False
End Sub
Private Sub Form_Load()
hDevice = INVALID_HANDLE_VALUE
End Sub
Private Sub Form_Unload(Cancel As Integer)
If hDevice <> INVALID_HANDLE_VALUE Then
If PCI8613_ReleaseDevice(hDevice) = False Then ' 釋放設(shè)備對(duì)象
MsgBox "PCI8613_ReleaseDevice Error..."
End If
End If
End Sub
Private Sub Timer1_Timer()
If PCI8613_GetDeviceCNT(hDevice, CNTPara, iCNTChannel) = False Then
MsgBox "GetDeviceCNT error="
Call Command1_Click
End If
TextCNTVal.Text = CNTPara.CNTVal
End Sub
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -