Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

configure and program PFI as static DO from Measurement Studio

I need to program a usb MIO PFI line as a static DIO output.  I can find no example (or even a reference to PFI in the user manual).  General examples for port based DIO exist.  This is not an option for me.

Measurement Studio 8.01
USB-6216

0 Kudos
Message 1 of 2
(2,952 Views)

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

Nathan
NI Chief Hardware Engineer
0 Kudos
Message 2 of 2
(2,934 Views)