Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Generate an output pulse after n ticks at a counter source

I have a counter configured to generate a pulse after a specified number of ticks at the source.  I have the signal routed to the source, but there seem to be errors counting quite often.  If I tell it to count 50 pulses (~10 Hz pulses, 10 ms wide), it generates the output after anywhere from 46 - 53 pulses.  It usually undercounts. 
 
The source is clean, it is being generated by another counter on a mx device, and it looks clean on a scope. 
 
The other question I have is I want it to count the falling edge of my pulse, it is counting the rising edge by default.
0 Kudos
Message 1 of 7
(4,680 Views)

1. Sounds odd -- can you post code?  How exactly do you determine the # of ticks to be something in the 46-53 range?  With clean signals, I've never seen counters behave erratically.  I'd want to first make sure that the method used for verification is sound.

2. (I'm going by memory but am 90% of this answer.)  In LabVIEW, you can specify falling edge sensitivity when you create the "count edges" virtual channel.  You can also configure it via a DAQmx Channel property node.

-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 7
(4,675 Views)

 

Here is the code.  I have the start icon in the next sequence. 

I am checking the number by collecting the pulses and the output of the counter on two ADC channels (all tasks are synced to start at the same time).  I can then look at the number of clock pulses, and see how many there were before the trigger went.  IT seems to be variable, and I am not sure why.

Could you tell me which icon I need to select to change the pulse direction it counts?  I have tried the ones, and could not find the correct one.

 

0 Kudos
Message 3 of 7
(4,664 Views)
I could not post the picture of code, so here is a link:
 
 
It should be there, and you can look at it.
0 Kudos
Message 4 of 7
(4,662 Views)

Hello mheien,

The Counter Output (Ticks) will generate a pulse which is high/low for the specified number of timebase ticks.  Using the example program, Gen Dig Pulse-Retriggerable.vi and modifying it to include a property node to specify a falling active edge should give you the results you are looking for.  The property you need to set is a channel property under Counter Output>>General Properties>>Counter Timebase>>Active Edge, shown below.  I used the timebase for the trigger as well.

Here is the result of a task I ran for an output high of 5 ticks and output low of 5 ticks.  You can see the timebase in red and my output in white.

Hopefully this helps,

Jennifer O.
Applications Engineer
National Instruments

Message Edited by Jennifer O on 01-18-2007 09:33 AM

Download All
0 Kudos
Message 5 of 7
(4,645 Views)

Hi Jennifer, 

 

May I ask how did you generate the feed for the graph that shows your timebase and the output? I have to ask because there is no such an example named "Gen Dig Pulse" in my example finder. Also, would you please generate a code screenshot?

 

In my configuration of the DAQmx blocks, the only type that shows a trigger is its name string, well, you know, it's not a real trigger signal. 

0 Kudos
Message 6 of 7
(2,952 Views)

There are no DAQmx counter task functions that will produce the data needed to produce such a graph.   Counter output tasks produce real world output signals but the DAQmx API does not produce any *data* representing those signals which could be sent to a graph or chart indicator.  Counter input tasks produce data, but not the kind pictured.  It'll give you something like edge counts or timing interval measurements (which are, at core, just a convenience wrapper around a particular kind of edge counting operation).

 

To see a scope-like display of the counter output *signal*, you would need to physically wire that output signal over to an input pin of your DAQ device and then create an input-oriented task to capture it.  It's probably easiest to do this with an AI task.  I'd further recommend an AI sample rate at least 20x your counter output frequency.

 

 

-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 7 of 7
(2,946 Views)