Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Gate one counter output with another (NI 6052E)

Hi,

 

I am using a NI 6052E card with Matlab 2020 (with Data Aquisiotin and Instrument Control Toolbox) and would like to use the Ctr0 as pulsegeneration TTL output (e.g. f1=1MHz) and then trigger this frequency with a second counter output (Ctr1, f2=200kHz) so that Ctr0 only generates pulses when Ctr1 is high.

 

This way I want to generate pulsetrains, in this example 5 TTL pulses, then pause, 5 pulses, pause, etc.

 

 

My code is at the moment around:

d = daq("ni");
ch1 = addoutput(d,"Dev1", "Ctr0" ,"PulseGeneration");
ch2 = addoutput(d,"Dev1", "Ctr1" ,"PulseGeneration");
ch1.Frequency = 1000000;
ch2.Frequency = 200000;
trig = addtrigger(d,"Digital","StartTrigger","External","Dev1/Ctr0Gate");

start(d, 'Duration', seconds(10));

 

I connected the output Ctr1out via cable to Ctr0Gate. However Ctr0 is generating TTL signals all the time, ignoring this trigger input at the gate channel and I don't know why.

 

Any help is appreciated,

Michael S

0 Kudos
Message 1 of 4
(1,228 Views)

I don't know any of the syntax for Matlab, but here are 2 main ideas:

 

1. You'll need 2 distinct counter tasks, one for ctr0 at 1 MHz, one for ctr1 at 100 kHz.

2. You should configure ctr0 to use the output from ctr1 as a *pause* trigger, not a start trigger.

 

 

-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 2 of 4
(1,218 Views)

That is indeed the problem.

Matlab (with their fancy data aquisition toolbox) only allows StartTrigger.

Therefore I am a bit at a loss and unfortunately not an electical engineer. I tried to connect many different in and outputs and all different kinds of connectors, but with no success.

0 Kudos
Message 3 of 4
(1,215 Views)

A simple external logic AND gate would do the trick too.  It's simple enough, it doesn't take an EE.

 

 

-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 4 of 4
(1,201 Views)