Re: Simultaneous reading from two channels?

On Sun, Jul 14, 2002 at 11:56:08PM -0700, Nicolas Cottaris wrote:
> Is there any comedi command that can do two successive reads as an 
> atomic operation, i.e. non-interruptible, operation?

No.  When used from real-time, you are completely on your own with
respect to locking.

> Making the reading task having the highest priority is not the solution, 
> as the other task must be
> scheduled always on time.  Like I said before, I only need to make sure 
> that I read from the two
> channels as simultaneously as possible.

It should be apparent that you need to have acquisition that is
timed by the hardware, otherwise you'll always have the problem
that if the CPU controls the timing from a low-priority task, it
can be preempted by a higher priority task.

Your best bet is to do timed streaming input with a small number
of scans, preferably 1.  However, not every driver (or device) will
properly handle 1 scan.  Also, the setup time for commands can be
annoyingly high.  If this is a big problem, you can start scans
using an external trigger, and toggle a digital line connected to
the external trigger input when you want to measure your analog
input samples.  (Or implement scan_begin_src=TRIG_INT for your
driver, which may or may not be easy or possible.)



dave...

Received on 2002-07-15Z18:18:29