From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using multiple counters for a pulse train

How do I go about using both CTR0 and CTR1 to run a pulse train?

 

I am re-working code from a lab that used TraditionalDAQ to DAQmx.

 

This is the current pulse train code:

 

2_counter.PNG

 

CTR0 is phyiscally wired to a relay. CTR1 is physically wired to a Digital line on the same DAQ card. 

This code above appears to simply syncronize the counters so that the digital line reads HIGH when the counter is HIGH..

 

This is my code for the pulse train on CTR0:

 

pulse_train.PNG

 

When I try values greater than 167 for the delay, I get the following error:

 

error_200136.PNG

 

Error text: 

Possible reason(s):

Frequency and Initial Delay property values are inconsistent with one or more counter timebase properties.

The conflicting properties must satisfy the following constraint:
Counter Timebase Rate / Counter Maximum Count <= X <= Counter Timebase Rate / 2
where X = Frequency and 1 / Initial Delay, and where Counter Timebase Rate = Master Timebase Rate / Counter Timebase Master Timebase Divisor or is inferred from the Counter Timebase Source selection.

Property: CO.Pulse.Freq
Corresponding Value: 5.917160e-3

Property: CO.Pulse.DutyCyc
Corresponding Value: 5.917160e-3

Property: CO.Pulse.Freq.InitialDelay
Corresponding Value: 0.0

Property: CO.CtrTimebaseSrc
Corresponding Value: MasterTimebase

Property: CO.CtrTimebaseRate
Corresponding Value: 20.0e6

Property: CO.CtrTimebaseMasterTimebaseDiv
Corresponding Value: 1

Property: MasterTimebase.Rate
Corresponding Value: 20.0e6

Possible Internal Timebase Rates: 20000000.0, 100000.0
Counter Maximum: 16777215
Channel Name: Dev1/ctr0

Task Name: _unnamedTask<218C>

 

The 'Counter Maximum' appears to be the issue.

 

I am not certain how the lab currently is able to run trials with a delay greater than that. I was told they are using the following two cards:

 

PCI-6036E

PCI-MIO-16XE-50

 

I use a PCI-6035E

 

I was not sure which specs on the manual of the cards to look at to compare.


Thank you!!

 

0 Kudos
Message 1 of 5
(2,792 Views)

Got some word from the lab, there was a miscommunication, they never used the code I was working off of for delays longer than 167 seconds!

 

Nevermind the error but if someone wants to answer the question regarding multiple counters, that'd be great..

 

This is just me thinking, can two counters be off-set?

Once CTR0 is done with 167s, the other can do another 167, for a total of ~ 324?

0 Kudos
Message 2 of 5
(2,771 Views)

belopsky wrote:

This is just me thinking, can two counters be off-set?

Once CTR0 is done with 167s, the other can do another 167, for a total of ~ 324?


Not quite sure I understand your question. Are you asking if you can use one counter as the trigger for another counter?

 

You could also get a longer delay by using the slower internal timebase.

0 Kudos
Message 3 of 5
(2,762 Views)

 

 

Can CTR0 go to the max amount and then trigger CTR1 to do the rest?

 

Can counters 'switch' back and forth and reach the alloted delay amount? 

 

As far as slower internal timebase, how do I go about that?

0 Kudos
Message 4 of 5
(2,759 Views)

You can use one counter as the trigger for another counter. You can also use one counter as the timebase for the other: the second counter will count ticks of the first counter (and those counts do not need to be evenly spaced, if you can find a way to vary it). I can't think of a way that two counters would switch back and forth.

 

To change the Master Timebase Divisor, try the DAQmx Task Property "Counter Timebase Master Timebase Divisor" found under Counter Output->General Properties->More. On your device you probably only have two options for the divisor: 1, or 200. Changing it to 200 will give you a clock that is 200 times slower, meaning your delay can be 200 times as long (but conversely, the shortest pulse you can generate will be 200 times as long).

0 Kudos
Message 5 of 5
(2,743 Views)