I am trying to read and write to PFI channels on NI PCI 6221.
1. Do I need to issue a comedi_dio_config() once for 16 PFI channels
or do I need to do it for all the 16 channels?
2. comedi_dio_config(): I am expecting either -1/+1 as a return value,
but I am getting a 0 both for input and output.
3. Regardless, I am able to read the input values without any issue,
but I cannot output any values.
> I am trying to read and write to PFI channels on NI PCI 6221.
> 1. Do I need to issue a comedi_dio_config() once for 16 PFI channels > or do I need to do it for all the 16 channels?
Once per channel. Both comedi_dio_config() and comedi_dio_get_config() are channel-specific[1]. The directions of the PFI channels are individually configurable.
[1] However, on hardware where the DIO channel directions are not individually configurable, but grouped into partitions of several channels, configuring the direction of one channel will affect all the channels in the same partition.
> 2. comedi_dio_config(): I am expecting either -1/+1 as a return value, > but I am getting a 0 both for input and output.
comedi_dio_config() returns 0 if successful, or -1 if an error occurred.
comedi_dio_get_config() returns 0 if successful, or -1 if an error occurred. If successful, the direction is passed back via the final pointer parameter.
> 3. Regardless, I am able to read the input values without any issue, > but I cannot output any values.
> Any suggestions?
> Thanks.
I'm not sure where the PFI outputs go by default. You may need to reroute each output channel with comedi_set_routing(), using the constant NI_PFI_OUTPUT_PFI_DO for the last parameter.
On Mon, Jan 23, 2012 at 6:24 AM, Ian Abbott <abbo...@mev.co.uk> wrote: > On 2012-01-22 09:47, GS wrote:
>> Hi,
>> I am trying to read and write to PFI channels on NI PCI 6221.
>> 1. Do I need to issue a comedi_dio_config() once for 16 PFI channels >> or do I need to do it for all the 16 channels?
> Once per channel. Both comedi_dio_config() and comedi_dio_get_config() > are channel-specific[1]. The directions of the PFI channels are > individually configurable.
> [1] However, on hardware where the DIO channel directions are not > individually configurable, but grouped into partitions of several channels, > configuring the direction of one channel will affect all the channels in > the same partition.
> 2. comedi_dio_config(): I am expecting either -1/+1 as a return value, >> but I am getting a 0 both for input and output.
> comedi_dio_config() returns 0 if successful, or -1 if an error occurred.
> comedi_dio_get_config() returns 0 if successful, or -1 if an error > occurred. If successful, the direction is passed back via the final > pointer parameter.
> 3. Regardless, I am able to read the input values without any issue, >> but I cannot output any values.
>> Any suggestions?
>> Thanks.
> I'm not sure where the PFI outputs go by default. You may need to reroute > each output channel with comedi_set_routing(), using the constant > NI_PFI_OUTPUT_PFI_DO for the last parameter.
> -- > You received this message because you are subscribed to the Google Groups > "Comedi: Linux Control and Measurement Device Interface" group. > To post to this group, send email to comedi_list@googlegroups.com. > To unsubscribe from this group, send email to comedi_list+unsubscribe@** > googlegroups.com <comedi_list%2Bunsubscribe@googlegroups.com>. > For more options, visit this group at http://groups.google.com/** > group/comedi_list?hl=en <http://groups.google.com/group/comedi_list?hl=en> > .
Hi, I am trying to do DIO read and write and I am trying to read all the 48 channels of NI PCI 6221.
Please correct me if I am wrong on this:
For read, below are the steps: comedi_dio_config(device, subDevice[i], channel[i], COMEDI_INPUT); comedi_dio_read(device, subDevice[i], channel[i], &data);
For write, below are the steps: comedi_dio_config(device, subDevice[i], channel[i], COMEDI_OUTPUT); if(subDevice[ii] ==7} { comedi_set_routing( device, subDevice[i], channel[i], NI_PFI_OUTPUT_PFI_DO); } comedi_dio_write(device, subDevice[i], channel[i], bit);
On Sun, Jan 29, 2012 at 11:43 PM, GS <grpsy...@gmail.com> wrote: > Ian: Thanks for the response. > Regarding my Q#2, the source of my confusion is this : > http://www.comedi.org/doc/r5849.html
> Also regarding my Q#3: I couldn't find comedi_set_routing() in the > documentation.
> Is there a newer version of this documentation?
> Thanks.
> On Mon, Jan 23, 2012 at 6:24 AM, Ian Abbott <abbo...@mev.co.uk> wrote:
>> On 2012-01-22 09:47, GS wrote:
>>> Hi,
>>> I am trying to read and write to PFI channels on NI PCI 6221.
>>> 1. Do I need to issue a comedi_dio_config() once for 16 PFI channels >>> or do I need to do it for all the 16 channels?
>> Once per channel. Both comedi_dio_config() and comedi_dio_get_config() >> are channel-specific[1]. The directions of the PFI channels are >> individually configurable.
>> [1] However, on hardware where the DIO channel directions are not >> individually configurable, but grouped into partitions of several channels, >> configuring the direction of one channel will affect all the channels in >> the same partition.
>> 2. comedi_dio_config(): I am expecting either -1/+1 as a return value, >>> but I am getting a 0 both for input and output.
>> comedi_dio_config() returns 0 if successful, or -1 if an error occurred.
>> comedi_dio_get_config() returns 0 if successful, or -1 if an error >> occurred. If successful, the direction is passed back via the final >> pointer parameter.
>> 3. Regardless, I am able to read the input values without any issue, >>> but I cannot output any values.
>>> Any suggestions?
>>> Thanks.
>> I'm not sure where the PFI outputs go by default. You may need to >> reroute each output channel with comedi_set_routing(), using the constant >> NI_PFI_OUTPUT_PFI_DO for the last parameter.
>> -- >> You received this message because you are subscribed to the Google Groups >> "Comedi: Linux Control and Measurement Device Interface" group. >> To post to this group, send email to comedi_list@googlegroups.com. >> To unsubscribe from this group, send email to comedi_list+unsubscribe@** >> googlegroups.com <comedi_list%2Bunsubscribe@googlegroups.com>. >> For more options, visit this group at http://groups.google.com/** >> group/comedi_list?hl=en<http://groups.google.com/group/comedi_list?hl=en> >> .
Configuring the PFI subdevice (subdevice 7) channels as inputs or outputs sets the direction of the physical PFI pins to input or output, but as the PFI signals can be routed to different functions inside the card, a PFI pin might not be routed to the "static DO" function.
* comedi_dio_config() controls the "Direction Control" signals. * comedi_set_routing() controls the input/output source selectors (the unlabelled trapezoid-shaped blocks on the diagram). * comedi_set_filter() controls the "PFI Filters" block. * comedi_dio_bitfield()/comedi_dio_bitfield2() may modify the "Static DO Buffer" bits and reads back the "Static DI" signals. * comedi_dio_read() reads a "Static DI" signal. * comedi_dio_write() modifies a "Static DO Buffer" bit.
Note that a "Static DO Buffer" bit (channel) does not appear on the corresponding PFI pin (channel) unless that PFI pin (channel) is configured as an output (COMEDI_OUTPUT) and is routed to the "Static DO Buffer" (NI_PFI_OUTPUT_PFI_DO).
> Thanks. I am able to do DIO, however, I am getting it to work without > comedi_set_routing.
> I am trying to understand this. Why does one need to use the > "comedi_set_routing" function. What is it doing exactly? Won't > comedi_dio_config() suffice?
> Thanks.
> On Feb 2, 4:52 am, Ian Abbott<abbo...@mev.co.uk> wrote: >> On 2012/02/01 11:08 PM, Sebas Inc wrote:
>>> Hi, >>> i have the same problem. I only can write the subdevice 2 of my NI_DAQ >>> 6220.
>>> Exist the comedi_set_routing function? my comedi version isn't CVS.
>> You could copy the comedi_set_routing function from git and rename it >> for your program. It's just a wrapper function around comedi_do_insn.