Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

6210 encoder measurement returns 0

Hey all,
 
I have an interesting problem using the USB-6210 to measure angular encoder information.  If I look at the inputs to the encoder using MAX, I can clearly see smooth counts rising when I perform edge counting on the specific PFI channels that I've defined (PFI 1 and PFI3 are CHA and Ch b respectively).  At the hardware level, I see no real issues (e.g. bad connections, noisy lines - edge counting seems to be rock solid on either PFI line).  When I try to read data from encoder using CVI or measurement studio (7.0 and 6.0 respectively - DAQMx version is 8.3.f0), I get zeros returned and no configuration errors.  TO make sure I wasn't doing anything in my code, I went to the example code (here is a snippet of the code).  Again, no errors and no change in values returned.   Does anybody have any thoughts?  I'm at the end of my debugging.  Interestingly, I switched to another 6210 that I had lying around in inventory and still no change.  This is a problem that just occurred, the last parts I received from NI worked fine using the same hardware setup and code - I'm begging to wonder if the quadrature circuit in this batch of 6210s is not quite right. 
 
Thanks in advance and I look forward to your responses.

Jeff
 
 
 
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
 DAQmxErrChk (DAQmxCreateCIAngEncoderChan(taskHandle,"Dev1/ctr1","",DAQmx_Val_X4,0,0.0,DAQmx_Val_AHighBHigh,DAQmx_Val_Degrees,120,0.0,""));
 DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"100kHzTimebase",100000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
 DAQmxSetChanAttribute (taskHandle,"Dev1/ctr1",DAQmx_CI_DupCountPrevent, 1);
 /*********************************************/
 // DAQmx Start Code
 /*********************************************/
 DAQmxErrChk (DAQmxStartTask(taskHandle));
 printf("Continuously reading. Press Ctrl+C to interrupt\n");
 while( 1 ) {
  /*********************************************/
  // DAQmx Read Code
  /*********************************************/
  DAQmxErrChk (DAQmxReadCounterF64(taskHandle,1000,10.0,data,1000,&read,0));
  printf("Acquired %d samples\n",read);
  for (i = 0;i < read;i+10)
   printf("\tSample Value is: %f\n",data[i]);
  fflush(stdout);
 }
0 Kudos
Message 1 of 3
(3,120 Views)

I also forgot to mention that I've tried using the default PFI lines for counters 1 and 0 with the same response.  The code snippet that I had below was testing using the default PFI lines for counter 0.  In our application, I set the encoder attributes to specify specific PFI lines.

Jeff

0 Kudos
Message 2 of 3
(3,117 Views)
Hi Jeff,

Thank you for posting on the National Instruments forums.

So you said that this hardware and software setup had worked previously, does that mean that you had the exact same model of DAQ card and the same DAQmx drivers?  One thing I noticed is that Channel A and Channel B on counter 1 are PFI 3 and PFI 2 respectively.  If you're using counter 0, the channels are PFI0 and PFI1 for Channel A and Channel B respectively.

It seems strange that you would have a setup that works previously but now have two DAQ cards that do not work.  It sounds like you might have to send in the two cards for RMA.  One thing we can try before we do that is to use the Hardware Input and Output >> DAQmx >> Counter Measurements >> Count Digital Events >> CntDigEv.prj.  Connect one of the channels of the angular encoder to PFI0 for the source of counter 0 and see if it counts up. 

Please try these two things and let me know what happens.
Thank You,

Nick F.
Applications Engineer
0 Kudos
Message 3 of 3
(3,085 Views)