04-09-2008 05:36 PM
04-10-2008
05:15 PM
- last edited on
07-24-2025
03:17 PM
by
Content Cleaner
Hi Derek,
All the PFI lines on the USB-6216 are also DIO lines. In order to write to them you will need to reference the pins port and line number. For example PFI 0 is also P1.0 or Port 1 Line 0. So the DAQmx physical channel name for P1.0 would be “Dev1/Port1/Line0”. What DIO lines are associated with the PFI lines can be seen on the USB-6216 pinout. The pinout can be found in the USB-621x Specifications on page 12 or 13.
For a good example of writing to a static DIO line I would look at the WriteDigChan example. This example can be found at C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DotNET2.0\Digital\Generate Values\WriteDigChan. This example does write to an entire port and not just one line. You can modify the example to just write to one line. Here is some code showing one way to modify the example. This code is in C# but it should be similar in VB. If you need me to I can make some example code for the language you are programming in.
using (Task digitalWriteTask = new Task())
{
digitalWriteTask.DOChannels.CreateChannel("Dev1/Port1/Line0","",ChannelLineGrouping.OneChannelForAllLines);
bool data = new bool();
data = bit0CheckBox.Checked;
DigitalSingleChannelWriter writer = new DigitalSingleChannelWriter(digitalWriteTask.Stream);
writer.WriteSingleSampleSingleLine(true,data);
}
This code creates a new task called digitalWriteTask. Then adds P1.0 as a channel in the task. It then writes the value of the bit0CheckBox to P1.0. Let me know if you have any questions and take care.
Thanks,
Message Edited by Nathan_R on 04-10-2008 05:16 PM