Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

6323-counter output -from external input

How do i setup a ctr1-external input terminal to go to same counter, ctr1 external output terminal continuously. I am looking the 6323 continuous output example. 

the ctr1-external input will come from a continuous ctr0 outputer terminal

0 Kudos
Message 1 of 16
(2,568 Views)

If i use continuous sample, will it output to the CO- Output default terminal with no trigger needed.

0 Kudos
Message 2 of 16
(2,567 Views)

Can you describe what you're trying to do in more detail?  What are the timing relationships needed between Ctr0 and Ctr1?   Will your program be in control of both?   Counter input terminals can be used for different kinds of functionality -- what kind of function do you want the Ctr1 input to serve?

 

 

-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 3 of 16
(2,518 Views)

Counter0 just generates a square wave output 50k CTR0-OUT ..

CTR0-OUT is fed into input of CTR1-SRC  (CTR0-OUT is conntected to CTR1-SRC-hardwired). The CTR1-OUT will output the same square wave pulse output.

CTR0-OUT is fed into input of CTR2-SRC  (CTR0-OUT is conntected to CTR2-SRC-hardwired). The CTR2-OUT will output the same square wave pulse output, but let's say divided by 2 --- 25k. --- 

So the input src -just is seen at the output...  continuously

 

0 Kudos
Message 4 of 16
(2,506 Views)

cntr1-src and cntr2-src are external inputs from cntr0-our

0 Kudos
Message 5 of 16
(2,498 Views)

NI's counters don't (quite) work that way.

 

The simple standard operation is that there are registers to hold integer values for both "Low Ticks" and "High Ticks" where the term "Ticks" refers to the active edge of the signal. 

    Both Low and High Ticks must be >= 2.   2 Ticks High and 2 Ticks low means 4 Ticks per full cycle, so you can only generate square waves on Ctr1 and Ctr2 that divide down the 50 kHz from Ctr0 by even integers >= 4.   Odd integers divide into different Low and High Tick #'s, making the output non-square.

 

If you get to control Ctr0 yourself, then you can just define Ctr1 and Ctr2 with the desired frequencies (which just get converted to Tick counts behind the scenes), set them up to Start Trigger from the non-active edge of Ctr0, and start Ctr1 & Ctr2 *before* starting Ctr0.

 

But I assume this is a trial run to check things out with your own Ctr0 signal whereas your real app will need to react to an external clock that it doesn't control.   So let's get to some other counter tricks.

 

1. The default mode for counter output is "toggle" mode.  Count down Low Ticks to 0, toggle the output state, Count down High Ticks to 0, toggle the output state, etc.  You can change that to "pulse" mode so that each countdown to 0 results in a very brief high-low pulse.  The duration is (I think) one cycle of the device's timebase which will likely be 100 MHz on modern-era DAQ devices I know of.   So you definitely won't get square output, but using this mode *does* let you divide down an external frequency by 2 or 3, as well as all the other integers >=4 that are also supported by the default "toggle" mode.

 

2. (This is the approach I'd prefer.)  You can set up Ctr1 and Ctr2 to output retriggerable single pulses.  You get single pulses by never calling DAQmx Timing (see the shipping examples as a guide).  You need a DAQmx Trigger property node to set the "retriggerable?" property to True.

    Assuming we react to rising edges from Ctr0, I'd likely define the absolute minimum value of 2 for both Low Ticks and Initial Delay.  I'd set High Ticks to try to match the pulse width of the Ctr0 signal.   If that's something you can't know ahead of time, I'd probably do a little pre-run sneak peak by briefly running a counter input task that measures it.

 

 

-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.
Message 6 of 16
(2,487 Views)

If i wanted to send the external input (maybe thru PFI-input) of cntr1, to it's output continuously. The pulse will just be exactly the same freq, pw, pri..

Is there a way to do that. Like maybe using 2 task for the same counter, 1 for input and 1 for output.

0 Kudos
Message 7 of 16
(2,479 Views)

Um, why?

 

Why not just physically wire the "input" signal to whatever is receiving your planned "output" signal?

 

Short direct answer: no, counters don't work that way.  You can't (in general) make an counter task where the output exactly replicates the input.

 

Here's something I've never tried though:  the function "DAQmx Connect Terminals" *might* be able to do something like you want.  It would probably implicitly consume one of your counters to do the routing, but it *might* be able to replicate an external clock.  But it still seems like physical wiring would be simpler.

 

 

-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 8 of 16
(2,456 Views)

Thank you for all your inputs and helps.

 

If i just wanted to generate a square wave pulse continuously  from the counter internally , like 50Khz will the task run and output the pulse with the example set to no trigger

I am using the example below

 

thanks

0 Kudos
Message 9 of 16
(2,430 Views)

Sure, that should work fine.  Have you tried it or do you not have the real DAQ device yet?

 

In case you have the DAQ device but no scope or whatever to confirm the output, you can use the Counter Input examples for that.  Set them up to let one of your other counters measure characteristics (freq, duty cycle, pulse width, period, etc.) of the signal being generated by Ctr0.

 

 

-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 10 of 16
(2,419 Views)