Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Questions about generating multiple channels pulse train.

I am using a pci 6602, labview 7.
I want to generate two pulse trains but I need have the option to controll the initial delay of both pulse trains.

I found this example: Generate_Pulse_Train-Mulitple_Counters_(NI-TIO).vi. It does not provide initial delay controll. Whenever I run it, the two signals I got are always at the same phase. Do you know any easy way to add those options or any other vi examples that have initial delay controll function?

I also tried to played with this single counter example: Finite Pulse Train(NI-TIO).vi but it did't work. Basically I duplicated the whole diagram then set counters 0 and 1. The delay seems right but both counters can only give me one pulse no matter how many I set.

I am still a newbie in labview coding and sorry if this is a dumb question. 🙂

many thanks.

yy
0 Kudos
Message 1 of 10
(4,162 Views)
Hi Yuany,

To control the initial delay of a counter, you can use the DAQmx Channel Property Node. You can place this property node after you define the task. I am attaching a screenshot of this property node, and you should use one of the DAQmx examples in the LabVIEW example finder. These examples can be found in the Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Generating Digital Pulses. For example, the Gen Dig Pulse.vi example has a control for the initial delay already defined. All you will have to do it use it. If you want to add this property to any other example, then just use the property node.

Have a Great Day!
0 Kudos
Message 2 of 10
(4,140 Views)
Hi, George,
Thanks for your answer.
I am still not quite clear about this problem. I checked my MAE and noticed that my PCI 6602 was listed under 'Traditional NI-DAQ Devices'. Could I still use this DAQmx? I am asking this since I found 6602 was not on the list of device which can run'Gen Dig Pulse.vi' example. And when I tried to run it, i got error: 200220, Device idenifier is invalid. The 6602 is my only device so I assume I should leave the counter as 'Dev1/ctr0', right?
Also this example does not support multiple channels, right? The one I am using is Generate_Pulse_Train-Mulitple_Counters_(NI-TIO).vi which I attached a copy here. Could I attach the DAQmx Channel Property Node to this vi to get initial delay controll?
Many thanks.

yuany
0 Kudos
Message 3 of 10
(4,134 Views)
HI, George,
I did a little bit search and realize I may need download the newer drive Ni-DAQ 7.3 to use DAQmx for my pci 6602. But stil it seems to me that Gen Dig Pulse.vi can only generate a single channel pulse. What I need are two(or three) channels pulse train with different initial delay. Any examples could I use?
thanks.

yuany
0 Kudos
Message 4 of 10
(4,129 Views)
Now my 6602 works under DAQmax 🙂
I tried this Example: Get_dig_Pulse_Train-Finite_Initial_Delay.vi. Since I need two channel pulse so I did a copy&paste in the diagram and set one counter as Dev1/Ctr0 and another Dev1/Ctr1. When I run it, it give me some error message and only Counter 1 can give me expected signal:
_ _ _
_| |_| |_| |_

the count 2 give me:
_________
_| |_

Here I set same delay for both output.

Did I do anything wrong?

thanks.
0 Kudos
Message 5 of 10
(4,120 Views)
sorry, i attached the wrong file in last post, please ignore it.
Here it is:
0 Kudos
Message 6 of 10
(4,117 Views)
yuany,

I'm not at a computer where I can open your vi's, but I'm pretty sure I know why you're having a problem. When you create a FINITE pulse train, DAQmx automatically sets up the additional "paired" counter it needs for the task.
The counter you specify creates a pulse train that is output only while the paired counter is generating a single hw-timed pulse. The combination of the 2 generates an exact # of pulses.

Ctr0 and Ctr1 are paired, so you can't output a finite pulse train with both at the same time. If you were to use Ctr0 and Ctr2, you'd be ok. (Note that DAQmx would automatically program Ctr1 & Ctr3 to support those finite pulsetrains.)

Final tip: since you want to specify initial delay for the counters, I think you'll probably also want to configure both to be started by the same digital start trigger. That'll preserve the timing relationship between the 2 outputs. It's possible to specify a digital bit as the start trigger which you can then fire programmatically.

-Kevin P.
CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 7 of 10
(4,105 Views)
Kevin,
You are right! I changed to ctr0 and ctr2 and it worked perfectly!
Thank you very much and have a good day!

yuany
0 Kudos
Message 8 of 10
(4,098 Views)
Guess I shouldn't say 'perfectly'. 😞

Now the signals are ok. I can generate two singals with different intial delay but I still get error message like this:

Error -200560 occurred at DAQmx Wait Until Done.vi
Possible reason(s):

Wait Until Done did not indicate that the task was done within the specified timeout.

Increase the timeout, check the program, and make sure connections for external timing and triggering are in place.

Task Name: _unnamedTask<48>
0 Kudos
Message 9 of 10
(4,094 Views)
problem solved by increasing the timeout number. Now i set it 100000 🙂
0 Kudos
Message 10 of 10
(4,090 Views)