(encoder part of) driver for NI-660x board

Please find enclosed a first implementation of a comedi-driver for
(the encoder part) of NI-660x boards.  The implementation is based on
the subdevice COUNTER, and allows the possibility to use this
subdevice for different Applications (Pulse Generation, Encoder, Time
Measurement, ...).

To configure the COUNTER subdevice, we use the data[0] field of the
insn struct --- as proposed by Herman Bruyninckx in his mail last week
(unfortunately, the comedi website appears to be down since yesterday,
so I can't provide you with the exact link from the ML archives) ---
to denote the application type of the counter (in casu 'quadrature
encoder" and the following field of data[] for the type of encoding
(x1, x2, or x4).

The current implementation only provides a quadrature encoder
(AB-encoder) as a subdevice (with instructions read, write, and
config), but I hope to add a "Pulse Generation" Application soon.

The attachment contains 5 files:
- ni_660x.c:  The actual implementation of the driver.  See the
  headers and the comments in the file for more information about the
  code and status.
- ni_660x.h: These are #defines that are needed by the Application
  Programmer and should eventually be included in <comedilib.h>
- test/common.h: A modified version of the command-line parser found
  in comedilib/demo/common.c
- encodertest.c: an example of how to turn your NI-660x device into
  a comedi-encoder card.
- A makefile to compile encodertest.c.

The code is tested against comedi 0.7.66 and [works for me].
Ie. We can read all 8 encoder channels in x1,x2 and x4 mode.

Since we have only a 6602 device, we welcome feedback on the NI 6601
card.

(Please let me know if you prefer a patch instead of these files.)

Thanks to J.P. Mellor for providing us his original driver.

Best regards,

Klaas Gadeyne

Received on 2003-04-15Z10:47:11