I am having an application, with a large code base, that uses NIDAQ driver APIs. I want to make my application supported in Windows Vista. I came to know that NI does not support NIDAQ under Windows Vista. So in Vista NIDAQmx driver should be used. This application uses around 20 functions of NIDAQ driver APIs.
My idea is to create a new DLL with name nidaq32.dll and export NIDAQ functions which are used by the application. From within the exported functions corresponding NIDAQmx functions will be called to implement the functionality.
Is this method practical? Is it possible, using this method, to implement functions of NIDAQ using NIDAQmx driver?
Some of the functions used are DAQ_Op, DIG_In_Line, DIG_Line_Config, DIG_Prt_Config, GPCTR_Control, GPCTR_Change_Parameter, GPCTR_Config_Buffer, GPCTR_Read_Buffer, GPCTR_Set_Application, GPCTR_Watch, Init_DA_Brds, Select_Signal etc
Regards
PraveendaMessage Edited by prav...@gmail.com on 05-02-2008 07:20 AM
How can I translate NIDAQ return values to NIDAQmx return values?
regards
Praveen.DA
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 <a href="http://digital.ni.com/public.nsf/allkb/DBADA18949DA4BDB86256C10006EA66F?OpenDocument" target="_blank">knowledgebase</a> provides some more information on these pins exactly so you can see what you are routing.
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 <a href="http://digital.ni.com/manuals.nsf/websearch/210C73CBF91128B9862572FF0076BE85" target="_blank">PCI-6251</a> 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.
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.
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 <a href="http://digital.ni.com/manuals.nsf/websearch/937C8FEC72331772862574030069E2B6" target="_blank">user manual</a> and the <a href="http://digital.ni.com/manuals.nsf/websearch/0118224913E0FA8D86257403006975F3" target="_blank">specifications</a>. 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.