07-08-2007 06:31 PM
07-09-2007 01:27 PM
Hello Britt,
You would want to use the DAQmxCfgSampClkTiming function for this application. If you set the sample mode parameter to finite acquisition, then the minimum number of samples that it will acquire is two. If you set the sample mode parameter to Hardware Timed Single Point acquisition, then one sample will be read every time that the DAQmx Read is called. The Samples Per Channel To Acquire parameter will let the driver know how many samples to acquire.
For you application it sounds that you would want to set the sample mode parameter to Hardware Timed Single Point acquisition and the Samples Per Channel To Acquire to one. The sample rate parameter would depend on your device. Most DAQ boards will have a maximum sample rate for one channel. Since you are reading from 6 channels, you might need to divide the maximum sampling rate by 6. The reason for this is there is usually only one ADC. All the analog input channels are then multiplexed into that ADC.
I could only tell you the maximum sample rate for 6 analog input channels after I know which device you are going to use.
07-09-2007 05:49 PM
07-10-2007 12:59 PM
hello my english is no godd, i write because i work whit the PCI 6132 and when i open de exsample for visual basic for Analogo in always "error 10459-interface Erro" i do the many thing tha are in the page of NI but to be the error , I wil be crazy because this is part of my tesis, please help me, o tell me what i do for the error dont to be.
thanks
07-10-2007 05:42 PM
Hello All,
carlinedanrii,
We prefer that you post new questions to a new forum so that we do not get the two subjects confused. I would recommend that you post your question to a Multifunction DAQ forum here. You may also want to check out this KnowledgeBase online. If you are still having problems I would recommend that you post to the DAQ forum. Specifically, you should also mention if you are using any ComponentWorks controls.
britt,
Let me try to address your questions in order:
1) The three valid parameters for the DAQmxAcquisitionType in Visual Basic are:
- NIDAQmxCAPI.DAQmxAcquisitionType.DAQmx_Val_AcquisitionType_ContSamps
- NIDAQmxCAPI.DAQmxAcquisitionType.DAQmx_Val_AcquisitionType_FiniteSamps
- NIDAQmxCAPI.DAQmxAcquisitionType.DAQmx_Val_AcquisitionType_HWTimedSinglePoint
You can determine these parameters by looking up the NIDAQmxCAPI.DAQmxAcquisitionType enumeration in Visual Basic 6.0. However, neither the USB-6009 nor the USB-6218 OEM devices support Hardware Timed Single Point analog acquisition, due to the high latency in the USB interface. That is why you are receiving the errors when you try to use that acquisition type with your devices. I would recommend that you examine the example called OneSample.vbp for a demonstration of how to take a single sample using software timing. This example is installed to the following location by default:
C:\Program Files\National Instruments\NI-DAQ\Examples\Visual Basic 6.0\Analog In\Measure Slow Varying Signal\One Sample
2) The fact that you are sampling so slowly may make the first point irrelevant. Software timed acquisition accuracy is dependant on the overhead of your code and the accuracy of your system clock. However, in general, this operation is accurate down to the millisecond range. So, instead of sampling your signal using hardware timing on the device to get into the kHz range, you could use software timing to take a single sample at intervals in the 100 Hz range. Forgive my pseudo code, but software timing would look something like this:
while(!done){
acquire data //code from the example program
Sleep(waitTime) //where waitTime is in milliseconds
}
07-11-2007 12:28 AM
07-11-2007 10:34 AM - edited 07-11-2007 10:34 AM
DAQmxCreateAIVoltageChan
int32 DAQmxCreateAIVoltageChan (TaskHandle taskHandle, const char physicalChannel[], const char nameToAssignToChannel[], int32 terminalConfig, float64 minVal, float64 maxVal, int32 units, const char customScaleName[]);
Purpose
Creates channel(s) to measure voltage and adds the channel(s) to the task you specify with taskHandle. If your measurement requires the use of internal excitation or you need the voltage to be scaled by excitation, call DAQmxCreateAIVoltageChanWithExcit.
Physical Channel Syntax
<script type="text/javascript"> </script>Use this syntax to refer to physical channels and groups of physical channels in NI-DAQmx.
Physical Channel Names
Physical channel names consist of a device identifier and a slash (/) followed by a channel identifier. For example, if the physical channel is Dev0/ai1, the device identifier is Dev0, and the channel identifier is ai1. MAX assigns device identifiers to devices in the order they are installed in the system, such as Dev0 and Dev1. You also can assign arbitrary device identifiers with MAX.
For analog I/O and counter I/O, channel identifiers combine the type of the channel, such as analog input (ai), analog output (ao), and counter (ctr), with a channel number such as the following:
ai1
ctr0
For digital I/O, channel identifiers specify a port, which includes all lines within a port:
port0
Or, the channel identifier can specify a line within a port:
port0/line1
All lines have a unique identifier. Therefore, you can use lines without specifying which port they belong to. For example, line31—is equivalent to port3/line7 on a device with four 8-bit ports.
Physical Channel Ranges
To specify a range of physical channels, use a colon between two channel numbers or two physical channel names:
Dev0/ai0:4
For digital I/O, you can specify a range of ports with a colon between two port numbers:
Dev0/port0:1
You also can specify a range of lines:
Dev0/port0/line0:4
Dev0/line0:31
You can specify channel ranges in reverse order:
Dev0/ai4:0
Dev0/port1/line3:0
Physical Channel Lists
Use commas to separate physical channel names and ranges in a list as follows:
Dev0/ai0, Dev0/ai3:6
Dev0/port0, Dev0/port1/line0:2
RelativeTo
Data Type: int32 Description: Specifies the point in the buffer at which to begin a read operation. If you also specify an offset with Offset, the read operation begins at that offset relative to the point you select with this property. The default value is DAQmx_Val_CurrReadPos unless you configure a Reference Trigger for the task. If you configure a Reference Trigger, the default value is DAQmx_Val_FirstPretrigSamp.
Valid values
DAQmx_Val_FirstSample 10424 Start reading samples relative to the first sample acquired. DAQmx_Val_CurrReadPos 10425 Start reading samples relative to the last sample returned by the previous read. For the first read operation, this position is the first sample acquired or the first pretrigger sample if you configured a reference trigger for the task. DAQmx_Val_RefTrig 10426 Start reading samples relative to the first sample after the reference trigger occurred. DAQmx_Val_FirstPretrigSamp 10427 Start reading samples relative to the first pretrigger sample. You specify the number of pretrigger samples to acquire when you configure a reference trigger. DAQmx_Val_MostRecentSamp 10428 Start reading samples relative to the next sample acquired. For example, use this value and set Offset to -1 to read the last sample acquired.
You can get/set/reset this property using:
DAQmxGetReadRelativeTo
DAQmxSetReadRelativeTo
DAQmxResetReadRelativeTo
Timing accuracy..................................... 100 ppm of actual sample rate
Timing accuracy..................................... 100 ppm of actual sample rate
Message Edited by Matt A on 07-11-2007 10:39 AM
07-11-2007 10:50 PM