Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI 6602 Counter Reset

Hello Everyone,

 

I have a PCI 6602 Counter board and using Visual 6.0 C++.  

I purchased the board to do the following: 

Part 1:

Take in two TTL signals, one at 10MPPS and the other one at 1 PPS.  The 10MPPS is the source of my counter to count at every rising or falling edge.  The 1 PPS is used to reset the count back to zero.  So at every 1 PPS event the counter starts counting from zero at a 10MPPS rate.  I have the 10Mhz in Pin#10 (PFI0) && 1PPS on pin #2 (PFI39).

Part 2:

Generate a software interrupt when counter reaches a programmable count value that is within the 1 to 10e6-1 count range (proportional to 10MPPS).  At each 1 PPS interval the count value will change; for example within the first 1 PPS interval, count value might be 100e3; for the next 1 PPS interval the count value might be 1e6, etc. etc.   Whenever the counter equals the count value a software interrupt is made. 

I was told by NI Reps. That the 6602 could do Part 1 & 2.  I coded Part 1 but I have had no success in making it work.  I keep getting an error which I show below.  Can someone please review my code and provide assistance in decoding error?

Code:

DAQmxErrChk (DAQmxCreateTask("",&taskHandle));

DAQmxErrChk (DAQmxCreateCICountEdgesChan(taskHandle,"Dev1/ctr0","",DAQmx_Val_Rising,

             0,DAQmx_Val_CountUp));

 

DAQmxErrChk (DAQmxStartTask(taskHandle));

DAQmxErrChk (DAQmxCfgDigEdgeStartTrig(taskHandle,"/Dev1/PFI0",DAQmx_Val_Rising));

 

DAQmxErrChk (DAQmxSetStartTrigRetriggerable(taskHandle, TRUE));

COMPILE ERROR:

DAQmx Erro: Specified property is not supported by the device or is not

applicable to the task.

Propert:  DAQmx_StartTrig_Type

Task Name: _unnamedTask<0>

Status code: -200452

End of Program, Press Enter Ket to Quit

 

Thank You,

a_perezjr

0 Kudos
Message 1 of 2
(3,150 Views)
I can only provide limited help as I only program the 6602 with LabVIEW and don't know the syntax for calls from C++.
 
1. There's only two ways I know of to make the count value reset based on an external signal, and *neither* of them works in edge counting mode.  (Frankly, I find this to be a fairly strange and quite unfortunate limitation). 
 
A. In pulse generation mode, the count value starts at some positive value (corresponding to low time) and counts down on every incoming source edge.  When the count reaches 0, the count value is reset to a possibly different positive value (corresponding to high time) and counts down to 0 again, etc.  Each time the count reaches 0, the counter output toggles state, and this is how pulse trains are generated.
   You could define a pulse with low time=(10e6 - 2) and high time=2, then know that your offset is calculated as (10e6 - 2 - count_value).
 
B. In position measurement mode, you can configure for measuring a "two pulse" encoder, meaning that pulses at one input cause counts to increment and pulses at the other input causes counts to decrement.  You would wire your 10 MHz signal to the decrement input and wire the increment input to digital ground.  You'd also have to configure z-indexing with a reload value of 10e6 (give or take 1 -- I forget now whether there's an off-by-one issue here).  You'd further configure the counter's output to "pulse on terminal count".  And you'd have to wire the output pin over to the gate pin to use it as the z-index pulse signal.  And you'd have to be careful to define the right z-index phasing.  And you'd still have to do a similar subtraction step so your offset = (10e6 - count_value).
 
2. Don't know of a method for generating software interrupts at a specific count value, where you change that target count value every second.  Perhaps it's possible, but I'm not aware of any such capability.  It could just be my ignorance because LabVIEW doesn't really provide a means for directly hooking and servicing interrupts, so I wouldn't have looked for or found that kind of feature.
 
3. Only counter pulse output tasks can be started off a digital start trigger.  Counter measurements must be triggered with what's called an "Arm Start" trigger.  Similar rules for "Re-triggerable" -- I'm pretty sure that's only available for output pulses, not for input measurements.
 
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 2 of 2
(3,143 Views)