Re: how to configure ni_6602 for quad encoding?

Ian Abbott wrote:
> int configure_quad(comedi_t *dev,
>         unsigned int subd,
>         unsigned int encoding,        /* GPCT_X1, GPCT_X2 or GPCT_X4 */
>         unsigned int indexphase,    /* GPCT_IndexPhaseHighHigh, 
> GPCT_IndexPhaseLowHigh, GPCT_IndexPhaseLowLow or GPCT_IndexPhaseHighLow */
>         unsigned int resetonindex    /* 0 or GPCT_RESET_COUNTER_ON_INDEX */
>     )
> {
>     comedi_insn insn;
>     lsampl_t data[4];
> 
>     memset(&insn, 0, sizeof insn);
>     insn.insn = INSN_CONFIG;
>     insn.subdev = subd;
>     insn.data = data;
>     insn.n = 4;
> 
>     data[0] = INSN_CONFIG_GPCT_QUADRATURE_ENCODER;
>     data[1] = encoding;
>     data[2] = indexphase;
>     data[3] = resetonindex ? GPCT_RESET_COUNTER_ON_INDEX : 0;
> 
>     return comedi_do_insn(dev, &insn);
> }

Ian,

Why do you pick insn.n is 4? Isn't .n based on the number of sample 
points you want to get back when inserting a data-read request? In the 
original test programs of Klaas Gadeyne .n for the config insert was set 
to 0. This turned out only to work when first a data-read or a 
get-time-of-day was performed on the device, but when .n was set to 1, 
it did work properly without the GTODs or data-reads. But other than 
this, it seems to an irrelevant option for configuring.

Regards,
Arno.

-- 
   ____
  /  |_| <<< IR. ARNO H.A. STIENEN >>>
|_ O  | Biomechanical Engineering | http://www.bw.ctw.utwente.nl
|_|__/  a.h.a.stienen_at_utwente.nl  | +31-(0)53-489-4778
UTwente "There are alternatives: Firefox, Thunderbird & OpenOffice!"

Received on 2006-03-09Z11:52:03