02-21-2007 02:13 PM
02-22-2007 06:43 PM
02-23-2007 08:59 AM
Hi David L.,
Yes you are correct in my objective, a Counter Input (CI) task. I started with a code example shipped with NI DAQ, namely Cnt_Buf_Cont_ExtClk.c .Unfortunately, using the DAQmxCICountEdgesChan function (which is the only function call for a Counter Edge task) only senses inputs at a single terminal (Gate or Source) of the specified Counter (default being Source). It ignores the activity on the other terminal. I've tried to use DAQmxConnectTerm and DAQmxCICoutnEdgesTerm to route a particular terminal (e.g. PFI4) to the gate, while using DAQmxCfgSampClockTiming but run into resource conflicts.
Do you have a suggestion for another function to create CI task, or how best to have the system use both gate and source terminals to timestamp?
Thanks for your assistance
02-26-2007 05:26 PM
02-26-2007 05:47 PM
Hi,
Thanks for the information. I'll try the digital pause trigger method and see how it goes. However, if the counter stops counting when the digital input (to be timestamped) occurs, then the absolute 'time' (counter state) will be delayed. Even if the counter state is delayed by one update, I imagine the accrued error will be large after minutes of recording.
Just in case others are tracking this thread, I found a good description of timestamping at http://zone.ni.com/devzone/cda/tut/p/id/5404 : Buffered Event Counting. Unfortunately, for me, it's in reference to LabView and not C/C++.
07-09-2021 09:06 AM
Dear DAQ learners,
In recent days,I read the DAQ X Series user Manual about Counter.
I want to use Gate signal and Source signal to make counter work on the high time of Gate Signal and not work on the low time of Gate time.
I really want to know that how can i use Gate siganl ?
When i connect the a TTL siganl to the Gate Terminal according to the NI MAX,the counter will work with the gate signal automaticly?
What parameters should i set?
Can i connect Gate signal to any PFI terminal?
Relative figures are showed below.
Looking forward to your reply!
Thank you very much!
Yuzn
July 9 2021
07-11-2021 09:01 AM
1. No, the gate signal is not automatic. The gate signal can play several different roles, depending on how you configure your counter task -- so you need to configure the task according to the behavior you want in response to the gate signal.
2. I *think* you are looking to use the gate signal as a "pause trigger". In this configuration, the count only counts while the gate signal is in the active state -- for you that would be the high state. Which means you'd configure to "pause" the task when the gate signal is low.
It isn't clear whether your task is about counting edges or generating pulses. What I said above is true for either one, but it may not be obvious what "counting" has to do with pulse generation. Down at the lower level, the timing of the pulse train is governed by counting a known constant timebase clock.
3. MAX will show you the available routes for your timing signals. In general, X-series are highly flexible for routing, so there's a large variety of PFI pins you'll be able to specify as your gate signal (aka your "pause trigger source").
-Kevin P
07-11-2021 10:16 AM
Thanks for your reply!
I want to genetate pulses and use gate as 'Pause Trigger'.But my pluse is defined by me.
There is a good news.I dicover that the retrigger function is useful for me to relize my control too.
But Labview has error that the fuction 'wait until done' warn my program overtime.But i have set a righttime for my program.
My program is showned below.
Thank you very much!
Yuzn
July 11 2021
07-11-2021 08:48 PM
I *think* I recall that a retriggerable task will never be considered "done". So you need to avoid calling "DAQmx Wait Until Done." Instead, you can put a software loop there to prevent the code from falling straight through to DAQmx Stop immediately after you call DAQmx Start.
You can look at the shipping example for continuous counter output for guidance.
-Kevin P
07-12-2021 04:13 AM - edited 07-12-2021 05:03 AM
You are right!Thank you very much!
By the way , I also have two questions.
First,i also want to know that how can i configure Gate signal to output signal as 'pause trigger' and what function should i use?
I think that if i connect a TTL signal which i defined as the source of Sample clock or StartTrigger ,the daq will connect the TTL signal to the Gate Signal automaticly.
Is my idea right?
Second,i want to use Continue pulse train genration to realize a Frequency Division ,should i use two counters to realize this function(one is used as source ,the other is used as Frequency Diviosion Out). What parameters should i configure?
Looking forward your reply!
Yuzn
July 12 2021