I'm running under Ubuntu 10.04 with RTAI and comedi off the RTXI live
CD, the card I'm using is a NI PCI-6221. We have used this card for
similar systems that were programed in c++ under windows with the
DAQmx drivers, with that setup both the encoder and the analog
channels were setup to use the same sample clock also.
You should be able to set up commands on the subdevice-specific file for
the counter subdevice, e.g. /dev/comedi0_subd11 for the first counter
subdevice, but I don't think you can set up a command to read both the
counter and the analog input in the same interval because each comedi
command can only access a single subdevice.
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abb...@mev.co.uk> )=-
-=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
As far as synchronizing the timer it looks like
comedi_get_clock_source and comedi_set_clock_source would be the
commands I would need to use to get the equivalent of what the windows
program does. I can't find any documentation about the clock source
functions.
Here's the channel setup code from the windows DAQmx program:
// Load Cell
DAQmxErrChk(DAQmxCreateTask("",&LoadCellTaskHandle));
DAQmxErrChk(DAQmxCreateAIVoltageChan(LoadCellTaskHandle,"Dev1/
ai0","",DAQmx_Val_RSE,-1.5,1.5,DAQmx_Val_Volts,NULL));
DAQmxErrChk(DAQmxCfgSampClkTiming(LoadCellTaskHandle,"",globals-
>Fixture.SampleRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,int(globals-
>Fixture.SampleRate)));
DAQmxErrChk(DAQmxRegisterEveryNSamplesEvent(LoadCellTaskHandle,DAQmx_Val_Acquired_Into_Buffer,CALLBACKFREQ,
0,EveryNCallback,NULL));
// Get trigger to slave encoder read to
DAQmxErrChk (GetTerminalNameWithDevPrefix(LoadCellTaskHandle,"ai/
SampleClock",trigName));
// Hardware (NI-DAQ) Encoder
DAQmxErrChk (DAQmxCreateTask("",&EncoderTaskHandle));
DAQmxErrChk (DAQmxCreateCIAngEncoderChan(EncoderTaskHandle,"Dev1/
ctr0","",DAQmx_Val_X4,0,0.0,DAQmx_Val_AHighBHigh,DAQmx_Val_Degrees,int(globals-
>Fixture.SampleRate)));
// Start data read function
DAQmxStartTask(EncoderTaskHandle);
DAQmxStartTask(LoadCellTaskHandle);
> -=( Ian Abbott @ MEV Ltd. E-mail: <abbo...@mev.co.uk> )=-