Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Porting strategy - NIDAQ application to NIDAQmx

Hello Praveenda,

The Traditioanl DAQ C Reference help that Andrew mentioned has some great information on all of the parameters for this particular function.  This instance of the signal connects ND_SCANCLK_LINE to ND_SCANCLK in the same manner as the pins are connected in the above post.  So you can use the DAQmxExportSignal() to route these signals as well. 

The DAQmxExportSignal() is used to route signals based on a task.  If you connect two particular pins in a task using the DAQmxExportSignal(), this connection will be undone when the task is cleared.  This is good so that you do not accidently try to connect signals that could damage your device or cause unexpected results.  The DAQmxConnectTerms() uses immediate routing and is not task based.  As a result it is pretty similar to Select_Signal().  You can see more information about it in the DAQmx C Reference Help.  One thing to note is that much of the routing needed from Traditional DAQ is done implicitly by DAQmx so you might not need all of these functions depending on the hardware configuration.  This knowledgebase provides some more information on these pins exactly so you can see what you are routing. 

Regards,
Browning G
FlexRIO R&D
0 Kudos
Message 11 of 22
(2,458 Views)

Thank you very much.

While creating a channel (voltage) a maximum and minimum value is needed. How it can be calculated/understand from legacy source (which uses NI-DAQ driver).

My legacy source is using following listed functions (NI-6013 PCI)
DAQ_Check
DAQ_Clear
DAQ_Op
DAQ_Rate
DAQ_Start
DIG_In_Line
DIG_Line_Config
DIG_Out_Line
DIG_Out_Prt
DIG_Prt_Config
Select_Signal

regards
Praveenda

0 Kudos
Message 12 of 22
(2,443 Views)
You don't create an analog channel for a digital task. You would be using DAQmxCreateDIChan or DAQmxCreateDOChan.
 
These functions have already been mentioned by Andrew as the replacements for your old digital functions.


Message Edited by Dennis Knutson on 05-29-2008 07:26 AM
0 Kudos
Message 13 of 22
(2,436 Views)

Sorry, in the legacy code both analog and digital channels are used. I am trying to port DAQ_Op function. My understanding is, DAQ_Op function is an analog, synchronous data read function.

For that,

1. Created a task using DAQmxCreateTask()

2. Created a AI channel using DAQmxCreateAIVoltageChan()

3. Set clock timing using DAQmxCfgSampClkTiming()

4. Started the task using DAQmxStartTask()

5. Read the data using DAQmxReadAnalogF64()

6. Clean up task.

Am I doing right in porting DAQ_Op function?

In step 2, minimum and maximum value of the signal is needed. Can this be found from any parameter (like sampleRate) of DAQ_Op function or any other function?

In the legacy code analog functions used are DAQ_Rate, DAQ_Start, DAQ_Check, DAQ_Clear and DAQ_Op.

thanks and regards

Praveen.da

0 Kudos
Message 14 of 22
(2,409 Views)
Sorry, missed the reference to DAQ_Op. With DAQmx, you specify an input voltage range and the driver automatically sets the correct gain of the device. While it is simple to get the supported voltage ranges of a device in DAQmx, i'm not sure how that corresponds to a gain setting.
0 Kudos
Message 15 of 22
(2,399 Views)

Hello Praveenda,

The steps you have enumerated above are how you would create a hardware timed task using DAQmx.  When you create a voltage channel you must set the maximum and minimum voltage values you expect to read.  DAQmx then uses this information to set the appropriate gain settings for your device.  You can use the specifications sheet for your hardware to determine the available hardware voltage levels.  For instance a PCI-6251 has several different hardware ranges available (±10 V, ±5 V, ±2 V, ±1 V, ±0.5 V, ±0.2 V, ±0.1 V).  DAQmx will pick the best hardware range that includes your software limits (this will get you the best resolution).  As a result, DAQmx will set the gain automatically for you in the background.  To find the maximum available values for any setting in your DAQmx task, consult your device’s specifications sheet.  This will provide the maximum voltage range, sample rate, etc. 

Regards,
Browning G
FlexRIO R&D
0 Kudos
Message 16 of 22
(2,389 Views)

Hi

I am doing a fairly simple port, converting software originally written for a NI6601 in Legacy NIDAQ to a USB 6210 in NIDAQmx. I am using the TwoEdgeSeparation task but I am having a problem finding an alternative tp the GPCTR_Watch which I originally used to display progress to the operator. So originally I could tell from the counter contents if the counter had started (start pulse has arrived) . Detecting the arrival of the stop  or timeout seems easy enough by checking that the task has finished.It's detecting the start pulse ( which can be too short to detect by a simple digital read) which is giving me a problem. Any ideas?

 

Regards

 

Martyn Eccles



Message Edited by martyneccles on 07-26-2008 02:04 PM
0 Kudos
Message 17 of 22
(2,240 Views)

Hello Martyn,

From your post it looks like you would like to determine the current state of your counter as your counter task runs.  From the Traditional NI-DAQ C Function Reference Help, I saw that the GPCTR-Watch function serves several different purposes depending on the parameter entityID that is assigned to it.  From your post, I was not sure which progress (or entity) you wanted to monitor and display to the operator.  There is not a direct drop in replacement for this function since DAQmx has a different method for checking the status of properties.  How were you checking for the start pulse with Traditional DAQ (which entity were you using with GPCTR_Watch)?  I am assuming that you are using C or LabWindows CVI to program your card.  If you look in the DAQmx C Reference Help (in Windows under Start -> Programs -> National Instruments -> NI-DAQ -> NI-DAQmx C Reference Help) there is a section about DAQmx events under NI-DAQmx C Functions -> Task Configuration/Control -> Events.  Using these events you can check to see when a task is completed, or register to have an event occur when a certain hardware event occurs.  One of these could be useful in your program.  Let me know if those help any as well as some more details on what exactly you are checking for in your counter task. 

Regards,
Browning G
FlexRIO R&D
0 Kudos
Message 18 of 22
(2,209 Views)

Dear BrowningG,

Thanks for your helpful advice but I'm still not out of the woods. Briefly, I am trying to do the following using a USB-6210 under mx using C++ Builder. Previously I have done exactly the same successfully using a pci 6601 under legacy Nidaq.

I have 4 TTL input lines called start1,stop1,start2,stop2. These are coming from sensors measuring the passage of a projectile launched at a test target (for the purposes of assessing the strenght of the target material). So, I want to measure the Time interval between start1, stop1  and between Start2 and stop2. On the USB 6210 I planned to use PFI0,PFI1 on one counter and PFI2,PFI3 on the second counter and program them each to to perform TwoEdgeSepChan measurements. The way it needs to work is that the system is armed and then some unknown time later (mabe a few seconds but possibly up to half an hour) the projectile is fired, the times recorded and then the system automatically re arms. When things are working well I could just enter an indefinite Read and wait for things to happen but in real life there will be a missing signal sometimes. Normally it is easy to monitor the counter behaviour to see if it has started counting (a start must have occurred) and then if the count is in an expected range (stop was received) or has overflowed ( stop didnt happen). This is important information for the user who would probably ajdust the sensitivity of the detectors etc to correct the problem. Previously I used GPCTR_Watch to read the counter progress ( 0 = no start, etc etc) and

The pulses on the PFI lines are quite short so I cant rely on reading the Digital inputs directly. I could put latches on the inputs but this would  negate most the benefits of using the USB6210 and it would be easier to put  a pci6601 into an external PC card connected expansion box (for Laptop use).

I have looked at your suggestion of using events , the obvious one being a DAQmxCfgChangeDetectionTiming  after creating a DIChan. I tried to use the MX example  ReadDigChan-ChangeDetectionEvent.c but (after adjusting it for 4 input lines)  an error is reported saying that DAQmx_Val_ChangeDetection is not a valid property status code -200077. I interpret this to mean that the change detection event is not available to the USB-6210 . Is tha right? Incidentally, is there a definition somewhere of what facilities are available for particular hardware?

Can you see an alternative approach to this  or is there another event that I could use?

 

Best Regards

Martyn

 

 

 

 

 

 

0 Kudos
Message 19 of 22
(2,191 Views)

Hello Martyn,

From your post I believe that I understand your application some.  It looks like you would like to perform two two-edge separation tasks that could occur at any time and that you would like to know if the counter has received the first pulse, but not the second.  Now it looks like you only need to know the edge separation times and not the time of the start1 or start2 event.  Is this correct, I am assuming this is the case in my proposed solution.  One idea would be to use a buffered counter task.  

What you could do is create a buffered counter task (configure the task timing to be implicit timing with finite samples and the number of samples be greater than or equal to 2).  This will allow for the task to be monitored without having to have a read timeout of -1.  After you configure the timing, you can start the task. 

Once the task is started, the counter will be armed and the device will start waiting for the start edge.  In the DAQStreamClass (configured when you perform a buffered measurement) has a property AvailableSamplePerChannel.  This property indicates the number of samples that are available to read.  Once the task has received both edges, this property will return a 1 as the number of samples available.  Until this occurs, the number of samples will remain at 0.  Once at least one sample is available for that task, you can call the read method (specified to read 1 sample, or use the ReadSingleSample method) to get the single sample that is available.  If a sample does not become available before a period of time that the user specifies (or if they get bored) then the user can stop the code execution.  Let me know if this is enough detail. 

You are correct; a change detection event is not supported by the USB-6210 because change detection is not supported on this particular device.  A great resource for determining the functionality of your device is the user manual and the specifications.  The manual provides great information on what types of tasks and timing for those tasks are supported and the specifications sheet gives great information on the accuracy of those measurements. 

Regards,
Browning G
FlexRIO R&D
0 Kudos
Message 20 of 22
(2,174 Views)