主题:[讨论]vb中如何将采集到的数据导入excel中
Private Sub ReadCntTimer_Timer()
Dim ptCounterEventRead As PT_CounterEventRead
Dim gwOverflow As Long
Dim gdwReading As Long
Dim gdwReading1 As Long
usChannel = 0
ptCounterEventRead.counter = usChannel
ptCounterEventRead.overflow = DRV_GetAddress(gwOverflow)
ptCounterEventRead.Count = DRV_GetAddress(gdwReading)
ErrorNum = DRV_CounterEventRead(DriverHandle, ptCounterEventRead)
If CheckError(ErrorNum) <> 0 Then
Call cmdStop_Click
Exit Sub
End If
usChannel = 1
ptCounterEventRead.counter = usChannel
ptCounterEventRead.overflow = DRV_GetAddress(gwOverflow)
ptCounterEventRead.Count = DRV_GetAddress(gdwReading1)
ErrorNum = DRV_CounterEventRead(DriverHandle, ptCounterEventRead)
If CheckError(ErrorNum) <> 0 Then
Call cmdStop_Click
Exit Sub
End If
'
labResult.Caption = Str(gdwReading)
Label3.Caption = Str(gdwReading1)
Label4.Caption = gdwReading - gdwReading1
我用的是研华1780的数据采集卡 谢谢大家了
Dim ptCounterEventRead As PT_CounterEventRead
Dim gwOverflow As Long
Dim gdwReading As Long
Dim gdwReading1 As Long
usChannel = 0
ptCounterEventRead.counter = usChannel
ptCounterEventRead.overflow = DRV_GetAddress(gwOverflow)
ptCounterEventRead.Count = DRV_GetAddress(gdwReading)
ErrorNum = DRV_CounterEventRead(DriverHandle, ptCounterEventRead)
If CheckError(ErrorNum) <> 0 Then
Call cmdStop_Click
Exit Sub
End If
usChannel = 1
ptCounterEventRead.counter = usChannel
ptCounterEventRead.overflow = DRV_GetAddress(gwOverflow)
ptCounterEventRead.Count = DRV_GetAddress(gdwReading1)
ErrorNum = DRV_CounterEventRead(DriverHandle, ptCounterEventRead)
If CheckError(ErrorNum) <> 0 Then
Call cmdStop_Click
Exit Sub
End If
'
labResult.Caption = Str(gdwReading)
Label3.Caption = Str(gdwReading1)
Label4.Caption = gdwReading - gdwReading1
我用的是研华1780的数据采集卡 谢谢大家了