I am currently trying to get a 3-channel continuous encoder position-measurment running.
1 channel works ok, but as soon as I add 1 more, data for channel 2 is incomplete - looks like data loss.
attached is an example 2chnnl measurment, signal fed to chnnl1 and chnnl2 is the same.
chnnl 1 is ok, as the encoder is rotating at constant speed.
programming is LW-CVI, derived from AngularPosition-Buff-Cont.c (sample program from CVI).
the measurment setup is as follows:
for (ch = 0; ch < Nch; ch++)
{
Fmt(TaskName[ch], "Task%d", ch);
DAQmxCreateTask(TaskName[ch],&taskHandle[ch]);
Fmt(Ctr, "%s%d", CtrBase, ch);
Fmt(chName, "ch%d", ch);
// ein/vierfachauswertung (X1/X4), ticks zählen
DAQmxCreateCIAngEncoderChan (taskHandle[ch], Ctr, chName, DecodingType,1, 0.0, DAQmx_Val_AHighBHigh, Units, pprev, 0.0, "");
// data transfer explizit auf DMA 16.07.07
DAQmxSetChanAttribute (taskHandle[ch], chName, DAQmx_CI_DataXferMech, DAQmx_Val_DMA, NCMAX / Nch);
DAQmxCfgSampClkTiming (taskHandle[ch], SampleSource, MAXRATE, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, Nsamp);
}
I also tried without the line 'DAQmxSetChanAttribute (taskHandle[ch], chName, DAQmx_CI_DataXferMech,DAQmx_Val_DMA, NCMAX / Nch)'
- result is just the same.
so, I suppose, DMA is just working for chnnl1, regardless, if explicitly set, or not.
I'm using a PCI 6602 card (which is supposed to do DMA on up to 3 channels), DAQMx 8.3, if that matters.
anyone has a clue what to try next ?
--
Once the game is over, the king and the pawn go back into the same box.