LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAqmx error when using one counter input&ouput task with finite samples

Dear all,

 

i come along a very strange error, where my code works with continuous sampling but not with finite samples.

Daqboard: PCIe-6259

Labview 2019

I'm using a counter as frequency generator as sample clock for the other tasks. I have a DO task which controls a couple of lines(the counter is the sample clock). At last i have a counter edge input.

I want to stop it after finite number of DO samples. But if i select finite samples get an error on one of the counter tasks, depending which tasks is started first. The error happens on the task which get started last. It says that resources are already reserved for some other tasks and cannot be shared.

But when i set everything to continuous sampling it runs smoothly. I couldn't find anything online why this happens. I hope someone has an explanation and maybe a fix.

I know the code is not organized well enough. Feel free to suggest changes 🙂

 

Thank you all!

 

Stay healthy,

Jan

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

That's an M-series device with 2 total counters.  On that generation of hardware (as well as earlier ones -- the E-series, the 660x series), finite pulse trains require 2 counters working together.  The one you configure makes the visible pulse output, but its adjacent neighbor counter is used to gate the pulse generation for the exact right amount of time.

 

Continuous pulse trains only use the counter you configure.

 

The newer X-series gives you 4 total counters, and you'd only use up 1 for a finite pulse train.  Progress.

 

Now here's the workaround:  What you can do for your app is to make the counter pulse train Continuous while making your DO task Finite.  The DO task will stop generating samples at the right time even though the counter keeps pulsing until you stop it manually.

 

 

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

Dear Kevin,

 

Thank you that explains a lot. I have two small follow question:

1: to the workaround: so i set the DO sample clock still to the internal output but just change the sampling type? I never thought about this because i guessed this would anyway cause an error. I will try it next week when have access to the DAQboard again.

2: Where can i find these information. I searched quiet a bit and also read the manual of the card but couldn't find anything. Do you just need to know this kind of stuff or can i educate myself somewhere?

 

Again thank you very much also for the fast response!

 

-Jan

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

1. Yes.  Still specify the counter's internal output as the sampling clock, just change the DO task to use Finite Sampling.  It'll work -- I've done this kind of thing before.

   (Tiny caveat:  I have a vague and old memory that there are some devices where AO tasks required 1 or 2 extra clock cycles more than the desired # finite samples.  Probably not your fairly common device and maybe not the same issue for DO.  But do some tests to make sure that you produce the expected # DO samples.)

 

2. Honestly, I'm not the best person to ask for *where* to find this stuff.  I am what most would consider an "old-timer" who slowly accumulated this knowledge over a long period of time.   Now and then I still learn something new, but I'm mostly just going by (sometimes hard-earned) experience.

   Very generally, this stuff is usually "findable" and verifiable once you know it's worth looking for and once you know enough jargon to search efficiently.  Sometimes that's the trick trick though.

   Hopefully someone who's learned some of this stuff more recently will chime in with a more helpful answer....

 

 

-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.
Message 4 of 4
(1,679 Views)