救急!谁写过CCD扫描系统的?
急!急!急!我写了一个星期了,还是搞不明白!有那位大师帮帮忙我用的是奥特梅尔LD线扫描相机和高速PCI 数据采集卡,就是不知怎么样读取数据和设置采集卡,下面是我写的程序各位帮看看那里出了问题
'启动采集
Public Declare Function lvDataAaqStart Lib "lvpci.dll" Alias "_lvDataAaqStart@16" (ByVal nDevNo As Byte, ByVal nMode As Byte, ByVal nDAQByte As Long, ByVal nTrigMode As Byte) As Long
'结束采集
Public Declare Function lvDataAaqEnd Lib "lvpci.dll" Alias "_lvDataAaqEnd@4" (ByVal nDevNo As Byte) As Long
'数据采集函数
Public Declare Function lvGetData Lib "lvpci.dll" Alias "_lvGetData@8" (ByVal nDevNo As Byte, ByRef rc As Long) As Long
Function 采集卡()
cc = lvDeviceIsOpen(0) '查询采集卡是否打开
If cc = False Then lvDeviceOpen (0) '如果采集设备没打开就打开采集卡设备
If cc = True Then lvDeviceClose (0) '如果采集设备打开就关闭采集卡设备
End Function
Private Sub 单次采集_Click()
If cc = True Then
ccd = lvDataAaqStart(0, 0, 524288, 0) '启动采集
Timer2.Enabled = True
Else
采集卡
End If
End Sub
Private Sub Timer2_Timer()
cdd = lvGetData(0, rc) '数据采集
Label1.Caption = cdd '问题出在这里CDD返回的是零。我设置返回的错误代码是“中断超时”
ccd = rc '数据采集返回提示信息
Timer3.Enabled = True
Timer2.Enabled = False
End Sub
Private Sub Timer3_Timer()
ccd = lvDataAaqEnd(0) '结束采集
Timer3.Enabled = False
End Sub
[ 本帖最后由 呀潘 于 2012-12-1 12:33 编辑 ]