LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure PFI lines?

I have an NI M series DAQ module. I need to configure the PFI lines (port 1 & port 2, each 8 bits wide) to input and output lines (they're sort of mixed) and set my output lines to some initial state (high or low). It seems that there are so many ways to do this. And that's where I'm confused.
 
There is the DAQmx Set Power Up States vi. Does this vi both configure AND write to the port lines? Or just writes to them?
 
Then there is the DIO Port Config vi and DIO Port Write vi. It seems that I can use that combination of vi calls to do the job. But then I ran into DIO Config vi and Write to Digital Port vi, and it seems that this combination should work as well. For writing to the lines there is also DIO Single Read/Write vi. I am confused as to which vi is best suited to do what I'm trying to do. And if they are all suitable, is there one that's more efficient than others? Keep in mind that I want to do this once at the beginning of my code to initialize the hardware. Can anyone tell me what's the best vi for configuring and writing to my hardware? Thanx a bunch.
 
Fataneh
0 Kudos
Message 1 of 5
(5,804 Views)
It's a lot easier to use DAQmx. The best way is to make sure you have the latest version of NI-DAQ installed, this would be V7.4. MAX and the DAQmx functions share much of the same functionality so you can configure things with MAX and just call them as tasks. If possible, you should just try and use MAX to configure a task and then see if it works, because it usually will. I think the pinout section of MAX shows the relationship between PFI lines and ports. You probably want to treat the lines simply as ports. There is also a section in MAX that shows the default mapping between PFI and functions. If you use DAQmx to configure a task, such as a gated counter, then it will reassign the PFI pins to the function needed for the task. So, you create the task in MAX and then set it up as a named task in LabVIEW. The only caveat is that the configuration of the task is stored in the MAX data space.
0 Kudos
Message 2 of 5
(5,796 Views)

Odd_Modem,

Thanx for the reply. I prefer to setup my port/lines programmatically, instead of creating tasks in MAX and calling them from my VI. I've run into some problems with that in the past. I realized after posting my question that with the Traditional DAQ VIs I have to specify a device number and my board being a DAQmx compatible, there is no device number assigned to it in MAX. So does this mean that the traditional DAQ VIs don't work for DAQmx compatible hradware?

Specifically, what is the best way to configure my port lines as inputs and outputs and set the output lines to some initial state? And do it all from inside my VI. Thanx.

Fataneh

0 Kudos
Message 3 of 5
(5,795 Views)
For multi-function cards the device number will show up in MAX for the traditional DAQ listing. Another option might be to use an Express VI to setup the DAQmx and then convert it to regular vis.
0 Kudos
Message 4 of 5
(5,788 Views)
Hi All-
 
The NI-DAQmx "device number" will actually also be found in MAX under NI-DAQmx devices and will be of the form "DevX" where X is a number.  Traditional (Legacy) NI-DAQ VIs will not work with NI-DAQmx only boards such as your M Series device.  For more information please see this post.  Please try to avoid posting your question in multiple threads in the future.
 
Thanks-
Tom W
National Instruments
0 Kudos
Message 5 of 5
(5,774 Views)