04-08-2011 04:35 PM
Hello,
I have been tasked with moving a service application that receives data across a PCI-DIO-32HS card from the NI-DAQ legacy code to a .NET service application. I'm trying to duplicate the functionality as close as possible as the system and would like to know if there is a transition guide for legacy to .NET code.
The legacy functions I am particularly interested in are:
Init_DA_Brds
DIG_Block_Check
DIG_Block_Clear
DIG_Block_In
DIG_Grp_Config
DIG_Grp_Mode
DIG_In_Prt
DIG_Out_Prt
DIG_Prt_Config
Regards,
Ron
04-11-2011 02:38 PM
I would use this article here. Also instead of using traditional DAQ our new DAQmx 9.3 driver supports this card and if you use that article you should be good to go.
04-11-2011 04:15 PM
Thanks but that article seems to focus on the transitioning of a Visual Basic 6.0 to Visual Basic .NET. I was looking at the Traditional NI DAQ non-graphical ANSI C code library functions to the NI-DAQm supported C# .NET methods. For example, in the old C legacy code the following functions are performed:
//The PCI-DIO-32HS is initialized, device number code returned is 211 for that hardware. It is the only device so the device number is 1
iStatus = Init_DA_Brds(deviceNumber, &deviceNumberCode);
//Clear Group 1 ports and set there direction to input
iStatus = DIG_Grp_Config(deviceNumber, // Device Number : 1, the PCI-DIO-32HS
1, // Goup : Configure group 1
0, // Group Size : Unassign all ports on group 1
0, // Port : Set to 0 since ports are being unassigned
0); // Port Direction : Set to port direction to input
//Clear Group 2 ports and set there direction to output
iStatus = DIG_Grp_Config(deviceNumber, // Device Number : 211 = PCI-DIO-32HS
2, // Goup : Configure group 2
0, // Group Size : Unassign all ports previously assigned to a group 2
0, // Port : Set to 0 since ports are being unassigned
1); // Port Direction : Set to port direction to output
//Configure port 1 to input with no hand shaking
iStatus = DIG_Prt_Config(deviceNumber, // Device Number : 211 = PCI-DIO-32HS
1, // Port : Configure port 1 (this card goes from 0 to 3)
0, // Mode : Configure port for no handshaking
0); // Port Direction : Set to port direction to input
//Configure port 3 to output with no hand shaking
iStatus = DIG_Prt_Config(deviceNumber, // Device Number : 211 = PCI-DIO-32HS
3, // Port : Configure port 3 (this card goes from 0 to 3)
0, // Mode : Configure port for no handshaking
1); // Port Direction : Set to port direction to output
So, I want to replicate those functions calls with the .NET equivalents. Now for the initialization of the card I assume creating a task and channel as outlined in the Measurement Studio sample code is like so:
//Create a task such that it will be disposed after we are done using it.
myTask = new Task();
//Create channel
myTask.DIChannels.CreateChannel( "Dev1/port0/line0:7", //Device 1, Port 1, lines 0-7
"myChannel", //Channel Name
ChannelLineGrouping.OneChannelForAllLines); //ChannelLineGrouping option (one or all)
But afterwords I'm not sure how to configure the port directions and perform block reads via the buffer data like the 'DIG_Block_In' call does?
FYI,
Ron
04-12-2011 01:47 PM
Sorry that didn't work for you. These articles cover more of the differences between Legacy and mx and also transfering using C. You can also find example of how to make the calls after you have installed the drivers. Start » All Programs » National Instruments » NI-DAQ » Text-Based Code Support » .NET 4.0 Examples.
http://zone.ni.com/devzone/cda/tut/p/id/5957
http://digital.ni.com/public.nsf/websearch/7759B0D2A8A392DF86256D21001B452E?OpenDocument