> Jonghyun Kim wrote: > > Thanks to the advise and 'gpct_encoder.c' in Comedi, > > it seems that the counter is successfully configured for quadratic > encoder. > > > > So, next step is to read the encoder. > > > > I tried to use a4l_sync_read() and a4l_snd_insn() to read the > encoder, > > but they did not work. The result always shows '0' value. > > > > Is it right to use a4l_sync_read() or a4l_snd_insn() for reading the > value > > of the encoder? > > Or, could you give me a sample code about this reading? > > > > What is the interest of reading a counter which is configured as a > quadratic encoder? I thought reading was only useful when the counter > is configured as an event counter. > > Anyway, which channel have you tried to read? According to the source > code (tio_common.c), the counter can be read on 3 channels: 0, 1 and > 2. > On channel 0, you read SW_Save_Reg (I thought this one was used for > event counting). > On channel 1 and 2, you read LoadA_Reg and LoadB_Reg; that may be the > ones you are looking for.
Nope, you should read channel 0. See e.g. <http://g-line.chess.cornell.edu/G-lineStatus/G-lineManuals/PCI-Boards/NI-6602-ProgrammingManual.pdf> page 2-6 HTH Klaas _______________________________________________ Xenomai-help mailing list Xenomai-help@gna.org https://mail.gna.org/listinfo/xenomai-help