Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

ctr0 Edge Counting Issue

I have a PXI-6602 and am writing a C++ class to control the card. I am experiencing an issue when using ctr0 for edge counting. My setup includes one PXI-6602 and a BNC-2121. I'm using the continuous pulse signal as the source signal to the counters. My software execute the following functions in order.

 

// Clear any old tasks
DAQmxClearTask( TaskHandle );

 

// Create new task
DAQmxCreateTask( "ctr0Task",
                          TaskHandle );
                
// Setup channel
DAQmxCreateCICountEdgeChan( TaskHandle,
                                            "\CTR1\ctr0"
                                            "",
                                            DAQmx_Val_Rising,
                                            0,
                                            DAQmx_Val_CountUp );
      
// Start Task
DAQmxStartTask( TaskHandle );

 

// Read counter value
DAQmxReadCounterU32( TaskHandle,
                                 DAQmx_Val_Auto,
                                 10,
                                 buffer,
                                 sampsRead,
                                 NULL );
                    
I execute the above code and let the task run for approximately one second. I read one sample of zero (0) counts on ctr0. When I execute the same code for the other counters, I read around 464 counts, which I believe to be valid.

 

Why am I reading zero counts on ctr0?

 

I have tried the following:
1) Using the Test Panel, I setup ctr0 for edge counting and used PFI39 (ctr0Source) as the source signal and everything worked as expected. So I know the hardware is working. I also selected the 20MHzTimebase signal as the source and everything worked as expected.

 

2) I manually setup a task within NI-MAX and everything worked as expected.

 

3) Within my software, I routed the 20MHzTimebase signal to ctr0 source and received counts although the value was incorrect. No matter how long I let the task run, I would only read around 260 counts. When routing the 20MHzTimebase to one of the other counter's source, everything worked as expected.

 

4) I also routed PFI39 to the source of the other counters and everything worked as expected.

 

Is ctr0 special or reserved? Does it have a unique timing characteristic that I'm unaware of?
      
Thanks in advance for any help.

-Mroche

0 Kudos
Message 1 of 2
(5,943 Views)

Hey

There should not be any issue. I have that board and used that in lv, but try the attached code and see if this works.

 

lab

0 Kudos
Message 2 of 2
(5,920 Views)