The counter subdevices for that board's driver support comedi commands
with external trigger sources, so you should be able to measure time in
terms of the value of a free-running counter at each trigger.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
- detect a change in the DIN lines
- read the DIN value from a set of DIN lines
- read the time
- inform the application about this event
So if I could setup the card to do both: change detected clocking of
CDI and reading of a timer/counter as well as signalling the user mode
application, that would be great. Is there an example for this ? Even
if I can't read the timer/counter from the NI for now, I think just
doing change detection clocked CDI and informing the app instantly
that this happened would be good enough for a start.
Thank you, Thomas
The digital I/O subdevices and counter subdevices are logically distinct
within the driver and commands only support reading or writing channels
on a single subdevice. You need to read channels from two different
subdevices. Also, from what I can tell, the ni_pcimio driver does not
support commands for reading digital inputs (but the ni_pcidio driver does).
If you had a card with sufficient digital inputs to cover the digital
inputs you are interested in and some way to derive a trigger from
changes to these inputs, and you also had enough spare digital inputs to
read the output from an external, free-running counter with parallel
output, and the driver for the card supported reading all these bits
using comedi_command, then what you want to achieve would be fairly
trivial! :-) (But you would either have to use a Gray-code counter or
synchronize the trigger to occur in the middle of the counter's clock
cycle.) The need for external digital logic may put you off this
solution though!
Thanks, Thomas
In general, it's when the device becomes readable, so the application
can use select() or poll() or just return from a blocking read().
The command has to be set up with the TRIG_WAKE_EOS flag to deliver data
at the end of each scan (and the driver would have to support that
flag), otherwise the data would just remain sat in a hardware FIFO until
a FIFO level triggered interrupt occurred.
Thomas
If you want a traditional Unix signal, you could set a signal handler
for SIGIO and use fcntl() on the comedi device's file descriptor to set
the O_ASYNC flag. I don't like signals much though - they can be a bit
too non-specific!