Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW DAQmx Synchronized Continuous Pulse Generation On Four (or more) Counter Outputs

I am working with a PXI-6608 counter\timer module and
would like to generate synchronized continuous pulse
trains on at least four of the eight counter outputs.
 
I was able to do this in the past using traditional NI-DAQ
but I am having difficulty with DAQmx.
 
Trying to use one of the digital outputs (PFI0) to
trigger all the counters simultaneously.
Counters 0 & 1 seem to be synchronized just fine
but there is no output on Counters 2 & 3.
 
Any help would be greatly appreciated!
 
Best Regards,
Scooby
 
0 Kudos
Message 1 of 11
(8,264 Views)

Hello Scooby,

I cannot think of a reason why you could be having this trouble.  Are you programming in LabVIEW?  Have you started from an example and modified it to meet your needs?  If not, I recommend taking an example that has the digital triggering functionality and using it for four counters.  In LabVIEW, you can use Gen Dig Pulse Train-Continuous-Dig Start.vi from the Example Finder.  If you are using C, you can use the example installed at C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Generate Pulse\Dig Pulse Train-Cont-Dig Start.  If you are using a .NET Language, there is an example at C:\Program Files\National Instruments\MeasurementStudioVS2003\DotNET\Examples\DAQmx\Counter\Generate Pulse\GenDigPulseTrainContinuous_DigStart

If you take a look at these examples and cannot get the output you desire, please post the code you are using so that we can take a look at it.

Thanks,

Laura

0 Kudos
Message 2 of 11
(8,254 Views)

Laura,

Thanks for the reply.

I figured out a solution to this problem. Not sure it is the "best" one but it works.

I generated a continuous pulse train on counter #6 and routed the output to PXI Trigger 0.

I then configured four other counters (0, 1, 2, 3) for single pulse operation with

the Start Trigger source set to PXI Trigger 0.

Now all four counters produce synchronized pulses at the counter #6 frequency setting.

Please let me know if you can think of a better solution.

Thanks again!

Best Regards,

Scooby

 

0 Kudos
Message 3 of 11
(8,246 Views)
This is the way I would do it, you create a continuous pulse train an all counters where one is a master timing ant the other are slaves, now you use the master as the start trigger so when you start the master pulse train all will synchronize with its starting edge.  Since you are using the same clock (internal) to general the timing you should have synchronous pulses for a while (depends on the error rate of each counter usually ppm).  One thing to note about this method is that you should start the slave tasks before the master, so the slaves will all be armed before the first trigger from the master is sent.
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 4 of 11
(8,237 Views)

Hello Scooby,

I am still convinced that the method I described should work.  You can use one task with all four counters in it, and use a start trigger to start the output.  However, you say that this does not work for you.  Would it be possible to post the code that you are using?

Thanks,

Laura

0 Kudos
Message 5 of 11
(8,231 Views)

Laura,

In daqMx can you still use multiple counters within a single task?  In traditional daq this was easily done but when I migrated to daqMX I ended up using a single task for each counter, configuring them, starting them and synchronizing them through a shared hardware trigger.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 6 of 11
(8,204 Views)
Hello Paul and Scooby,

You can indeed use multiple counters within one single counter task in NI-DAQmx for generating pulse trains.  You can use the DAQmx Start Trigger VI to easily synchronize all the counters in this task to start from a single digital pulse trigger.  The only caveat to this is that these counter start triggers and synchronous counting capabilities are only available on DAQ cards that support NI-TIO (660x) and those that use the NI-STC2 (all M-series devices).  This means that counter start triggering is not available on E-series devices.  Here are two links to a Knowledgebases that describe this further.

KnowledgeBase 3GGATSCC: Hardware Counter Start Trigger for Counter Synchronization

M Series – The New Data Acquisition Standard – Frequently Asked Questions

I'm not sure why you have been unable to trigger the start of more than two counters within a single DAQmx task.  I have tested it here and was able to trigger four counters to start generating pulse trains after receiving a digital start trigger on PFI0.  I used a PCI-6602 counter/timer board that contains the same NI-TIO chip as your PXI-6608.  This was all done in LabVIEW within one counter task.  Let me know if you need any further help or want the forum to take a look at your code.

Regards,
Travis Gorkin
Applications Engineering
National Instruments
www.ni.com/support

0 Kudos
Message 7 of 11
(8,175 Views)

Hey travis,

 

I have very similar problems in PXI 6602 cards, Please take a look

 

 http://forums.ni.com/ni/board/message?board.id=40&view=by_date_ascending&message.id=7642#M7642

0 Kudos
Message 8 of 11
(7,039 Views)

I have an application that I have used for over 10 years that uses all 8 counters on a NI-6602 under NI-DAQ 7.4.  Any of the 8 counters can be setup as either PulseTrainGeneration or Retriggerable - no caveats - no restrictions.  I have used the RTSI0 line to tie the output of counter0 to the gate inputs of 4 of the other counters - no problem.  I have recently been trying to port my C code over to NI-DAQmx 9.2 so that I could migrate my application to Windows 7.  From this conversion process I have discovered that the functionality of the NI-6602 card is not fully supported under NI-DAQmx.

 

After several weeks of trial and error - and little support from the NI staff I have found the following undocumented features of the NI-6602 under NI-DAQmx:

I can configure Ctr0 as DAQmx_Val_FiniteSamps and Ctr1 as DAQmx_Val_ContSamps only if I assign them both to the same taskHandle: "task1".

 

Likewise I can configure Ctr2 as FiniteSamp and Ctr3 as ContSamp - only if they are both in the same taskHandle: task2  Try to put the counters all in the same taskHandle and you will get the 50103 error!  Try to set both counters as DAQmx_Val_FiniteSamps and you will get a 50103 error.  Try to set a separate task handle for each counter - and you will get a 50103 error (unless of course you are setting them all for DAQmx_Val_ContSamps (PulseTrainGeneration Mode).

 

It appears that in this manner I will only be able to configure 4 retriggerable counters and 4 continuous generation counters.  This prevents me from supporting my previous application.  This is still not the same flexibility/capability that was available under NI-DAQ 7.4.  Under NI-DAQ 7.4 any of the 8 counters on the 6602 could be configured as either PulseTrain Generation or Retriggerable.  I find it completely unacceptable for NI to remove/reduce the functionality of the hardware when upgrading driver software to NI-DAQmx!  I am inclined to return all 15 of the NI-6602 boards that I own and ask for my money back - since you are no longer supplying the functional capability that was available/advertized when I purchased the hardware.

 

I believe in your effort to make the driver software nice/flexible (i.e. the ability to connect the output of a counter to multiple gates on other counters - when previously a RTSI0 line was required) has reduced the functional capability of the hardware.  Please relay my comments to the software developers.

 

As for me - I am eternally trapped in the unsupported universe of NI-DAQ 7.4.

0 Kudos
Message 9 of 11
(5,747 Views)

This issue has been resolved. 

 

"buffersize" (see function call below) must be set to 1 for the counter to be put into retriggerable mode and not generate a (50103) error code.

 

DAQmxErrChk (DAQmxCfgImplicitTiming(taskHandle[1],DAQmx_Val_FiniteSamps

,buffersize));

 

With buffersize =1, each counter can be either ContSamps or FiniteSamps, and each counter can have its own taskHandle.

0 Kudos
Message 10 of 11
(5,742 Views)