Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a counter divider with DAQmx

I need to create a divided counter from an existing counter output on a DAQ card using DAQmx. The code was written in traditional DAQ. I have created my primary 10khz counter on counter channel 1, but now need to create a divide by 1000 counter output on my counter 0 line. (I cannot reassign the counters - as the system hardware is pre-existing and wired.
 
I've not found any examples on how to create a divisor counter in DAQmx. I am using an M Series card.
 
Counter 1: 10khz output on PFI13
Counter 0: 10hz output down-clocked from Counter 1
 
Regards
Jack H.
 
0 Kudos
Message 1 of 3
(5,028 Views)

Hello Jack,

DAQmx can use the output of counter 1 to generate a signal that is 1000 times slower.  I have attached a screenshot of some code that does this.  This code creates a counter output task that counts the number of pulses/tics to generate a waveform.  You then specify the 'source of tics' of this task to be counter 1's internal output (/Dev1/ctr1internaloutput). 

In your case, if you have a 10 KHz signal coming out of counter 1, you would specify the number of high and low tics to be 500 so that each square wave period out of counter 0 is 1000 periods out of counter 1.  There is some good information in Context/LabVIEW help to explain how this counter output task works.

Regards,

Jesse O.
Applications Engineering
National Instruments

Jesse O. | National Instruments R&D
Message 2 of 3
(5,016 Views)

I am having the exact problem that Jack was having. I have some old code written using Daq and I need to upgrade to Daqmx. The hardware device that I am controlling can not be rewired. I need to create a clock frequency using counter 1 and divide that clock using counter 0 with a PCI-6032e board.

 

The older code written in DAQ and using the PCI-6032e card works great. Using Daqmx I can create the clock signal without a problem using counter 1. However, when I try to use the Dev/CTR1InternalOutput as a source of ticks for the CTR0 to create the divided frequency (as shown by Jesse in the example above) I get an error message code 89136 that says "Specified route can not be satisfied, because the hardware does not support it." This is very puzzling because I know that the hardware can support it because the same card performs this operation using the DAQ code.

 

I have not had any luck resolving this issue, although I am sure that it is a simple one. Please help.

 

I have attached the code.

0 Kudos
Message 3 of 3
(3,771 Views)