11-08-2005 10:27 AM
11-09-2005 07:40 AM
Irena,
Can you post your code? Otherwise I can only take a few guesses.
1. I looked up a couple of similar threads you were in and it appears you're using traditional NI-DAQ. So starting with the instant that the active trigger edge comes in, both pulse trains start. When they start, they will be in idle state first (Low by default), then go to pulse state (High by default). The time spent in each state depends on the freq and duty cycle. At the very lowest level, you can specify 'Pulse Spec 1' and 'Pulse Spec 2' using "Counter Set Attribute.vi", corresponding to time in idle state and time in pulse state respectively.
So, what frequencies do you need to generate? And are the duty cycles important? If your external devices respond only to, say, rising edges then you should be able to get the two pulse train's first rising edges in sync. You would just need to be sure that they are configured with the same value for 'Pulse Spec 1' (time in idle state). At least one of the output pulse trains will have to be non-square.
2. Can you switch to DAQmx? It provides one additional pulse property called "Initial Delay" which specifies a special value for time spent in idle state used only for the very first pulse. Under DAQmx, you could make both pulse trains square but set their "Initial Delay" values to be equal in order to line up their first rising edges.
-Kevin P.
11-09-2005 08:49 AM
Thanks, Kevin.
The duty cycles and the Frequencies are important.
The slow train is used like gate for fast signal.
In the Calculate Pulse Specs for Phase Delay.vi you can see that duty cycle and frequency are used to calculate the pulse width and delay of a pulse.
New train always begins from "Delay" - and it's different for different frequencies- this is my problem. Is the idle time this very first delay or it is the time before frequency output?
There are no examples for counter to DAQmx- and i can't use it.
Irena.
11-09-2005 10:04 AM
The slow train is used like gate for fast signal
New train always begins from "Delay" - and it's different for different frequencies- this is my problem. Is the idle time this very first delay or it is the time before frequency output?
There are no examples for counter to DAQmx- and i can't use it.
11-10-2005 02:17 AM
11-10-2005 08:00 AM
Irena,
I first want to be sure I understand *exactly* what you need. Some parts may not quite work out, but I'm hopeful we can at least get real close.
1. When I look at the timing diagram you labeled "what I need", I see that both the slow and fast signals start in High state at the exact instant of the trigger's rising edge. Further, you show that the fast signal is an exact integer multiple of the slow signal, so every rising edge of the slow signal will occur during a rising edge of the fast one. The "gating" you mentioned earlier in the thread is done by the external device, so your program always puts the pulse trains out to the output pins. Is this right so far?
This may be either easy or impossible. If you were to set both fast and slow pulse train polarities to have a High delay and Low pulse, you could almost duplicate the timing diagram. The only exception is that both counters would already be in in idle (High) state while waiting for the trigger. So neither one would show a rising edge at the instant of the trigger. Everything after that could match up.
If you need to generate those initial edges, I'm afraid I don't know of a way to do it. The counters' pulses always start with the idle state before the pulse state, and in triggered mode they wait for the trigger in idle state too. The earliest edge you can make is by defining a pulse with a very short idle state (duty cycle >99%). However, I understand that's not really an option.
2. Again, how exactly does the external device respond to your pulsetrains? Since you referred to "gating", I would suppose that it responds to the state (High or Low) of the slow signal(s) and doesn't particularly care about edges. But what about the fast signal? Does it react to rising edges? Rising and falling? Or is it also sensitive only to state? If it only responds to state, then the inverse polarity mentioned earlier should work.
3. Sorry to pester, but why is it that you can't use DAQmx? It's "initial delay" feature could make the difference between whether you can make this app work or not...
4. I'll try to look at your code when I can -- my network PC isn't near a LV PC.
5. Where does the trigger signal come from? Is there any possibility of taking in that "real" trigger and generating a delayed trigger that is used by the rest of the system? That may open up some more options...
-Kevin P.
Just as a note: if the slow signal's period is always an integer multiple of the fast signal's period, then the slow one wouldn't need to be triggered.
11-10-2005 09:45 AM
Hi, Kevin!
I am sorry for disturbing you.
The only exception is that both counters would already be in in idle (High) state while waiting for the trigger -it may work, but changing ouput polarity changes state before trigger to high too.
11-10-2005 11:36 AM - edited 11-10-2005 11:36 AM
Message Edited by Otis on 11-10-2005 11:37 AM