05-02-2008 07:19 AM - edited 05-02-2008 07:20 AM
Hello
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
Praveenda
05-02-2008 10:46 AM
05-04-2008 11:35 PM
Hello
1. While porting an application using NI-DAQ APIs to NI-DAQmx APIs, I found it difficult to find an equivalent function(s) in NI-DAQmx for DIG_Prt_Config(). Is there any function in NI-DAQmx, which can be used to replace DIG_Prt_Config?
2. I am overriding NIDAQ functions. From this overridden functions corresponding NIDAQmx functions are called to do the exact functionality. I am facing several unknowns in my path. One of it is the mapping between NIDAQ and NIDAQmx return values.
How can I translate NIDAQ return values to NIDAQmx return values?
regards
Praveen.DA
05-05-2008 05:39 PM - edited 05-05-2008 05:39 PM
Hi,
1. Dig_Prt_Config performs a lot of different actions for a lot of different devices. For several of these operations you need to use multiple functions from DAQmx. What HW are you using, and what are you trying to do with it?
2. By return values, are you referring to the error code and values passed back by all functions? Again, this will depend a lot on the function calls...
Let me just say, there is not a 1 to 1 mapping of Traditional DAQ and DAQmx functions. When the driver was redesigned, the API was redesigned as well. In some cases things are very similar but in others they differ greatly. I have ported a lot of code from Traditional to DAQmx, and find that it is easier for me to figure out what the Traditional DAQ code is doing, then port that concept over to DAQmx. I don't worry about matching up function calls. As long as you know that a piece of code in Traditional DAQ uses two counters to perform a frequency measurement then it does not matter what Traditional DAQ functions were used (there are usually several ways to do the same thing in both APIs) because you know how to achieve the same thing in DAQmx.
I realize this may not sound as easy as just replacing the functions with DAQmx code, but I think you're just beginning to see the complexity of matching up DAQmx code with legacy functionality. There are a couple resources out there, this one is good for C:
Transitioning from Traditional NI-DAQ (Legacy) to NI-DAQmx Using ANSI C and NI LabWindows™/CVI
It has a good overview of the differences and porting code, though I'm afraid it will be missing some of the specifics that you're looking for. Hopefully it will remove some of the unknowns.
Hope this helps,
Andrew S
05-07-2008 03:13 AM
Hello
The above said application uses NI 6013 PCI. I dont know what exactly the application does.
I am trying to develop an adapter DLL which will recieve the NI-DAQ function calls and implements the functionality by using NI-DAQmx APIs. That is why I am trying to map functions in NI-DAQ with NI-DAQmx. Is this method feasible?
regards
Praveenda
05-07-2008 11:31 AM - edited 05-07-2008 11:32 AM
Praveenda,
It is feasible if you have an understanding of Traditional DAQ and DAQmx. In order to do this, you would need to figure out what the Traditional DAQ function call was setting up in HW and translate that to a DAQmx function call. Since it is not a 1 to 1 mapping, you would need to build up some code to acount for different situations.
Looking at Dig_Prt_Config, let's look at two cases. ***
Dig_Prt_Config(1, 0, 0) means that device 1, port 0 will be configured for input. In DAQmx, you would use
DAQmxCreateTask("", taskHandle); //create task
DAQmxCreateDIChannel(taskHandle, "Dev1/port0", "", DAQmx_Val_ChanForAllLines); //create input channel for port 0
Dig_Prt_Config(1, 0 , 1) means that device 1, port 0 will be configured for output. In DAQmx, you would use
DAQmxCreateTask("", taskHandle); //create task
DAQmxCreateDOChannel(taskHandle, "Dev1/port0", "", DAQmx_Val_ChanForAllLines); //create input channel for port 0
This is just taking into account changing one parameter. Other parameters will require different function calls and settings dependent on the use cases... for a limited set of functions this may not be that hard, but you will need to spend some time with the C function help for both DAQmx and Traditional DAQ to translate things. However, creating this wrapper may prove more work than just replacing the code - instead of creating a function that looks at each TDAQ parameter and uses that to make decisions on how each DAQmx function call is used and how it may be easier to just rewrite your Traditional DAQ code on case by case basis. If you stick with writing a wrapper, you're going to need to figure out how to maintain different DAQmx Tasks among the different calls, and the way buffers and events are handled may not map directly.
As a broad generalization, I think it is easier to write new code than to create a wrapper.
cheers,
Andrew S
*** I don't code in C that often so my code may be off a bit but you should get the idea.
05-13-2008 01:49 AM
05-14-2008 01:07 AM
Hello
How can I translate NI-DAQ Select_Signal() to NI-DAQmx? (NI 6013 PCI)
Two scenario of select signal used are;
Select_Signal(DAQ_Board_No, ND_PFI_2, ND_IN_CONVERT, ND_HIGH_TO_LOW)
Select_Signal(DAQ_Board_No, ND_SCANCLK_LINE, ND_SCANCLK, ND_LOW_TO_HIGH)
regards
Praveenda
05-14-2008 11:14 AM
Praveenda,
For reading/writing digital lines, check out the "Write Dig Chan" and "Read Dig Chan" shipping examples. In XP you can find them here - C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\
The documentation in the examples is probably your best resource.
For the Select_Signals, again you'll have to figure out what these are doing and translate this to DAQmx. For:
Select_Signal(DAQ_Board_No, ND_PFI_2, ND_IN_CONVERT, ND_HIGH_TO_LOW)
If you check the Traditional DAQ C function reference Help (under Start>>All Programs>>National Instruments>>NI-DAQ if you haven't found it yet) you'll see that that function is just connecting ND_IN_CONVERT to PFI_2. In DAQmx you can do this with DAQmxExportSignal() - check the DAQmx C Reference Help on how to use it.
05-23-2008 04:59 AM
Thank you very much.
One more usage of Select_Signal is
Select_Signal(NIDAQBoardNo, ND_SCANCLK_LINE, ND_SCANCLK, ND_LOW_TO_HIGH)
What the above function call will perform?
Can I use DAQmxExportSignal() to translate the above call to DAQmx?
Does the DAQmxConnectTerms() can be used instead of DAQmxExportSignal()?
thanks in advance
Praveenda