发表于:2004-01-07 21:15:00
楼主
刚买进凌华的USBDAQ-9100MS。
有几个问题向凌华的工程师请教:
振波传到传感器时,时间无法把握,所以希望以信号达到某个门槛值时触发采样。
拟用USBDAQ-9100MS的下列函数来实现:
1、UD_AI_ContScanChannels (ByVal deviceNumber As Integer, ByVal Channel As Integer, ByVal AdRange As Integer, Buffer As Integer, U32 ReadCount As Integer, ByVal ScanRate As Double, ByVal SyncMode As Long) As Integer函数
2、UD_AI_ContReadMultiChannels (ByVal deviceNumber As Integer, ByVal numChans As Integer,
Chans As Integer, AdRanges As Integer, Buffer As Integer, ByVal ReadCount As Long, ByVal SampleRate As Double, ByVal SyncMode As Long) As Integer函数
这两个函数中,SyncMode参数指定了触发方式,只有同步“UD_SYNCH_OP”、异步“UD_ASYNCH_OP”两种值可选。
3、设定触发条件函数UD_AI_Trigger_Config (ByVal deviceNumber As Long, ByVal TriggerEnable As Long, ByVal TriggerWay As Long, ByVal TriggerSource As Long) As Long
其中:
deviceNumber: Index of Device
TriggerEnable:
0: Disable Trigger Function
1: Enable Trigger Function
TriggerSource:
Bit Field Source
0 Software 软件触发
1 8254 Timer 2 OUT 定时器触发
2 8254 Timer 1 OUT 定时器触发
3 8254 Timer 0 OUT 定时器触发
4 External Digital Trigger 外部触发
5 Analog Trigger High 模拟量升高触发
6 Analog Trigger Low 模拟量降低触发
7 Reserved 保留
TriggerWay:
0: Level Trigger(Used as GATE), active when selected source is high
1: Edge Trigger, First rising start trigger, second rising stop trigger在第一上升沿开始,第二上升沿停止。
对于TriggerSource取5,模拟量升高触发;TriggerWay取0。
4、UD9100_Analog_Trigger_Set (ByVal deviceNumber As Integer, ByVal SourceChannel As Integer, ByVal index As Integer, ByVal AdRange As Integer, ByVal Voltage As Double) As Integer
其中:
deviceNumber: Index of Device
SourceChannel: Analog Input Channel number. 模拟输入触发通道号
Index: 指定升高触发还是下降触发
0: TRIG_VH 升高触发
1: TRIG_VL 下降触发
AdRange: The array contains analog input range. Please refer to the Appendix B for the valid range values. 模拟输入的电压范围数组?
Voltage: 模拟输入的电压门槛值
由于没有例程可看,现在问题来了:
1、对于UD_AI_Trigger_Config;UD9100_Analog_Trigger_Set这两个函数的参数理解翻译是否正确?
2、当采用模拟输入的振波电压门槛值触发时,TriggerSource取5(模拟量升高触发);TriggerWay取0,是否正确?
3、在UD9100_Analog_Trigger_Set函数的参数AdRange,应该是什么样的数组构造?
4、模拟输入的电压门槛值Voltage=30mv,是指在现有水平基础上再上升30mv触发?还是指电压值达到30mv就触发?
5、UD_AI_ContReadMultiChannels 与 UD_AI_ContScanChannels 的应用差异在什么地方?
6、这些函数的调用逻辑次序似乎是:
UD_AI_Trigger_Config
UD9100_Analog_Trigger_Set
UD_AI_ContReadMultiChannels 或 UD_AI_ContScanChannels
因为我要用双缓冲实现连续采样,问题在于这个次序能否打乱?