01-05-2006 06:30 PM
01-09-2006
03:58 PM
- last edited on
11-06-2025
03:32 PM
by
Content Cleaner
Hello ChrisErven,
Your first question: "The VB6 code never set a port it got set with some legacy code, do I have to worry about this?"
You are setting the port and lines to be sampled from within the ' myDigitalTask.DIChannels.CreateChannel(...)' method. The first argument to that function, called 'lines', is a string that contains the physical device number, port, and line information for your task. A digital I/O task can treat a whole port as one virtual channel or the task can be set to treat each line of a port as an individual channel. The 'OneChannelForAllLines' argument is telling your task to treat the whole port as a virtual channel, and all you need to supply is a port number. For a task to access each line individually you would use 'OneChannelForEachLine', and you will then need to supply port and line information for the task. The standard syntax for DAQmx physical digital channels is "DevX\portX\lineX", where the X's are the numbers of the device, port, and line you want to access. When using 'OneChannelForAllLines', simply exclude the "\lineX" part of the channel name. From the looks of your C# example code, it looks like the program is getting the device, port, and line information from a combo box on your main form titled 'cbPhysicalChannel'. You can have a combo box on your form automatically populate with a list of appropriate channels (similar to how drop down boxes for physical channels work in MAX and LabVIEW) by including something similar to the following code in your MainForm section of code:
DigitalPhysicalChannel.Items.AddRange(DaqSystem.Local.GetPhysicalChannels(PhysicalChannelTypes.DILine, PhysicalChannelAccess.External));
if (DigitalPhysicalChannel.Items.Count > 0)
DigitalPhysicalChannel.SelectedIndex = 0;
This method is used all throughout the example programs to have the combo boxes automatically populate with the appropriate channel names, so take a look at other example programs to see how this is done. Finally, I would recommend checking out the example programs on our online database (www.ni.com/examples) for some more guidance on programming DAQmx programs in .NET. I hope this information helps!
Regards,
Travis Gorkin
Applications Engineering
National Instruments
01-09-2006 05:20 PM
01-09-2006 06:14 PM
01-10-2006
06:31 PM
- last edited on
11-06-2025
03:32 PM
by
Content Cleaner
Hi Chris,
The DAQmx driver automatically performs the double buffering for continuous digital input operations. Therefore, there is no extra programming/functions needed for this operation. You will only need a continuous digital input application.
I found a continuous digital input example configured for an external clock. Here is the link: C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Read Values\Cont Read Dig Chan-Ext Clk. You will have to make some modifications which are documented in the NI-DAQmx C API Visual Basic 6.0 Help which is located in Start >> All Programs >> National Instruments >> NI-DAQ.
Here is the link to a tutorial which has some useful information about the DAQmx driver: Answers to Frequently Asked Questions about NI-DAQmx and Traditional NI-DAQ (Legacy). I hope that you find this information helpful.
Regards,
Hal L.