标题:VB数据采集中脉冲信号怎样处理呢?
只看楼主
davidzhuzhu
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2008-2-2
 问题点数:0 回复次数:1 
VB数据采集中脉冲信号怎样处理呢?
下面是数据采集卡的采集程序的TIMER(记数用,),不知道怎样才能用一个按钮控件将计数值count清零,而且每次采集开始count的值也不是从0开始,很奇怪
Private Sub Timer1_Timer()
Dim overflow As Integer
  Dim Count As Long
  ErrCde = DRV_DeviceOpen(0, DeviceHandle)
If (ErrCde <> 0) Then
DRV_GetErrorMessage ErrCde, szErrMsg
Response = MsgBox(szErrMsg, vbOKOnly, Error)
Exit Sub
End If
  lpCounterEventRead.counter = lpCounterEventStart.counter
  lpCounterEventRead.overflow = DRV_GetAddress(overflow)
  lpCounterEventRead.Count = DRV_GetAddress(Count)
  ErrCde = DRV_CounterEventRead(DeviceHandle, lpCounterEventRead)
  If (ErrCde <> 0) Then
        DRV_GetErrorMessage ErrCde, szszErrMsg
        Response = MsgBox(szszErrMsg, vbOKOnly, "Error!!")
        Exit Sub
End If
Text1.Text = Str(Count)
End Sub
搜索更多相关主题的帖子: 数据采集 脉冲 信号 DRV overflow 
2008-07-11 20:49
weqr1082
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2010-1-28
得分:0 
Dim Count As Long
Count =1
Private Sub Timer1_Timer()
Dim overflow As Integer

 if Count >=50 then
    Count =1
end if
  ErrCde = DRV_DeviceOpen(0, DeviceHandle)
If (ErrCde <> 0) Then
DRV_GetErrorMessage ErrCde, szErrMsg
Response = MsgBox(szErrMsg, vbOKOnly, Error)
Exit Sub
End If
  lpCounterEventRead.counter = lpCounterEventStart.counter
  lpCounterEventRead.overflow = DRV_GetAddress(overflow)
  lpCounterEventRead.Count = DRV_GetAddress(Count)
Count=Count+1
  ErrCde = DRV_CounterEventRead(DeviceHandle, lpCounterEventRead)
  If (ErrCde <> 0) Then
        DRV_GetErrorMessage ErrCde, szszErrMsg
        Response = MsgBox(szszErrMsg, vbOKOnly, "Error!!")
        Exit Sub
End If
Text1.Text = Str(Count)
End Sub
2010-02-03 10:19



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-223554-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.022574 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved