09-09-2022 11:08 AM
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
09-09-2022 10:58 AM
If i use continuous sample, will it output to the CO- Output default terminal with no trigger needed.
09-11-2022 06:53 AM
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
09-12-2022 11:40 AM
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
09-12-2022 12:04 PM
cntr1-src and cntr2-src are external inputs from cntr0-our
09-12-2022 12:38 PM
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
09-12-2022 01:07 PM
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.
09-13-2022 01:04 AM
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
09-14-2022 11:41 AM
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
09-14-2022 02:06 PM
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