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.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
--
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 comed...@googlegroups.com.
To unsubscribe from this group, send email to comedi_list+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/comedi_list?hl=en.
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.
int my_comedi_set_routing(comedi_t *device, unsigned subdevice,
unsigned channel, unsigned routing)
{
comedi_insn insn;
lsampl_t data[2];
memset(&insn, 0, sizeof(comedi_insn));
insn.insn = INSN_CONFIG;
insn.subdev = subdevice;
insn.chanspec = channel;
insn.data = data;
insn.n = sizeof(data) / sizeof(data[0]);
data[0] = INSN_CONFIG_SET_ROUTING;
data[1] = routing;
if(comedi_do_insn(device, &insn) >= 0) return 0;
else return -1;
Hi GS,
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.
If you look at Figure 8-1 in the "DAQ M Series User Manual"
<http://www.ni.com/pdf/manuals/371022k.pdf> then for subdevice 7:
* 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).
Best regards,
Ian.
On 2012-02-03 00:46, GS wrote:
> Ian,
>
> 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.
>>
>> int my_comedi_set_routing(comedi_t *device, unsigned subdevice,
>> unsigned channel, unsigned routing)
>> {
>> comedi_insn insn;
>> lsampl_t data[2];
>>
>> memset(&insn, 0, sizeof(comedi_insn));
>> insn.insn = INSN_CONFIG;
>> insn.subdev = subdevice;
>> insn.chanspec = channel;
>> insn.data = data;
>> insn.n = sizeof(data) / sizeof(data[0]);
>> data[0] = INSN_CONFIG_SET_ROUTING;
>> data[1] = routing;
>>
>> if(comedi_do_insn(device,&insn)>= 0) return 0;
>> else return -1;
>>
>> }
>>
>> --
>> -=( Ian Abbott @ MEV Ltd. E-mail:<abbo...@mev.co.uk> )=-