Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6008 IsDone function in .NET doesn't work

Hi,

I suppose DAQmx (version 9.2.35.32 and 8.9.*.*) has bug with USB-6008 counter driver.

IsDone function always returns true.

 

I don't see this problem with PCI-6251.

 

Thanks

 

0 Kudos
Message 1 of 11
(7,131 Views)

Hello Vasilich,

 

Can you explain more in detail about your code?  I will try to recreate your program at headquarters and see if we can solve this issue and/or provide you with more results.

 

Regards,

Roman S.

Regards,
Roman Sandoval | National Instruments | RF Systems Engineer
0 Kudos
Message 2 of 11
(7,103 Views)

Very primitive ... something like that ...

========

 

Task TaskCounter = new Task();

TaskCounter.CIChannels.CreateCountEdgesChannel( "Dev1/Pf0", "", CICountEdgesActiveEdge.Falling, 0, CICountEdgesCountDirection.Up);

CounterReader ReaderCounter = new CounterReader(TaskCounter.Stream);

TaskCounter.Control(TaskAction.Verify);

 

bool bIsDone1 = TaskCounter.IsDone;

TaskCounter.Start();

//delay

bool bIsDone2 = TaskCounter.IsDone;

TaskCounter.Stop();

//delay

bool bIsDone3 = TaskCounter.IsDone;

 

=========

bIsDone1, bIsDone2, bIsDone3 are true but bIsDone2 must be false.

 

 

0 Kudos
Message 3 of 11
(7,099 Views)

Hello Vasilich,

 

We were able to recreate this issue and R&D is currently working to have this resolved.  Thank you for addressing this concern.

 

Regards,

Roman S.

Regards,
Roman Sandoval | National Instruments | RF Systems Engineer
0 Kudos
Message 4 of 11
(7,084 Views)

I'm not too sure about the concept of Is Task Done? for an on-demand task.  It appears like some hardware behaves one way (always True) and some hardware beahves differently (will never return True until the task is manually stopped).  Is there a specific behavior that you are trying to achieve or problem that you are trying to address?

 

I'll agree that the behavior is strange and we can file a Corrective Action Request to make sure it is at least investigated.  However, I'm not sure what the use case would be for using Is Task Done? with an on-demand task so I'm not sure how high of a priority this will be.  How are you trying to use the function in the context of your application?

 

 

Best Regards,

John Passiak
0 Kudos
Message 5 of 11
(7,079 Views)

To John:

 

Do you for NI?

 

0 Kudos
Message 6 of 11
(7,060 Views)

I currently work for NI, yes.

 

 

Best Regards,

John Passiak
0 Kudos
Message 7 of 11
(7,057 Views)

Sorry but I don't understand why did you ask here about Is Task Done insted of ask NI developers directly?

 

From the simplest vision

Behaviour of "Is Task Done" must be the same for any card according manual. Also NI introduced Task States in DAQmx and it should be way to know about it. So it would be better to have better function.

 

From global vision.

I suppose DAQ and DAQmx have ONE goal of NI hardware + DAQmx combination. It is not only set of functions to connect with hardware. It is more or less unified API that introduced the same approach (actions and behavior) to any NI device. This position is really interested for developers because the developers wouldn't need to know each bit in control registers and exact behaviour of each hardware card. That helps to develop faster, support easy, and upgrade later. Finally, that brings additional money for NI.

If NI hardware + DAQmx combination would work like in my case with USB-6008 then developers will have more troubles than advantages. For example, I spent few hours catching this bug.

 

Hope someone from NI will also explain of goal of NI hardware + DAQmx combination instead of talking that hardware or software is different and asking me why would like to use any function Smiley Wink

and fix the bug Smiley Tongue

 

P.s. nothing personal.

 

0 Kudos
Message 8 of 11
(7,042 Views)

I was just legitimately curious about why you are calling Is Task Done? while running an On Demand task--it is usually used to check for finite tasks being complete, or to simply poll the driver to see if there is an error during execution.  Is there specific information you are trying to get or functionality you are trying to achieve?  Perhaps there is another way to do so.

 

 

The description from the LabVIEW Help for Is Task Done? states that it:

 

    Queries the status of the task and indicates if it completed execution. Use this VI to ensure that the specified operation is complete before you stop the task.

 

It appears that defining whether or not an On-Demand task is complete is the inconsistent part.  It does look like different hardware families (not just the 6008) treat the definition of "complete" differently for On Demand tasks, but I'm not sure if it's something we can change if we want to avoid breaking backwards compatibility (which I would argue is more important than maintaining compatability between different hardware families in most cases).  There are legitimate explanations for either definition of "complete":

 

    1)  M Series:  The task is not running

 

    2)  6008:  The driver has received an interrupt from hardware indicating that it has completed its operation (no such interrupt occurs for On Demand Tasks)

 

It's quite possible that the different behaviors are an unintended consequence to developers deciding to take advantage of hardware interrupts to determine whether or not a task is "done".  X Series boards actually show the same behavior as what you are seeing on your 6008 (using DAQmx 9.2.2).

 

 

I'm not against filing this to our developers as a bug--the behavior is certainly inconsistent and is not intuitive.  However, I don't think it can be changed without the negative consequence of breaking backwards compatibility.  It is certainly worth a discussion on our end, but as far as I can tell there isn't a very good reason to be relying on this function for an On Demand task in the first place.  If you have a good use case for using the Is Task Done? function on an On Demand task that would help justify development time as well as the risk of breaking backwards compatibility across driver versions, please let us know.  The most likely resolution to this is better documentation indicating the different behaviors between hardware families.

 

 

 

You are absolutely correct that we would like the DAQmx driver to be a unified driver that is consistent across all hardware families.  We do try to keep the API as consistent as possible between hardware, but different devices have different features and functionality so complete consistency isn't always possible to achieve.

 

 

Best Regards,

John Passiak
Message 9 of 11
(7,035 Views)

Few comments ...

- I tried to use IsTaskDone for synchronization. Program has 2 threads. Each thread can start and stop counter.

- There are a lot of way to make system differently based on history system, money, developer preference, and so on. Another point is if the system isn't simple as standard example than it is harder to explain the system than to get real parameter of card. Moreover, I tried couple times to ask about parameter or behaviour and it was hard to get answer. That is life and that is why I didn't want to spend time.

- Technically, I see 2 ways to avoid this bug if hardware doesn't support this function.

At first, it can be simulated by software. I used this way - "bool bIsDone;"

At second, use exception. For example, if program will use with USB 6008 Rising instead of Faling

TaskCounter.CIChannels.CreateCountEdgesChannel( "Dev1/Pf0", "", CICountEdgesActiveEdge.Rising, 0, CICountEdgesCountDirection.Up);

DAQmx will send exception.

 

- .NET help has only  Queries the status of the task and indicates if it completed execution. This explanation is fussy and "completed execution" link doesn't work. To avoid problem I searched and found similar question in this forum, tested with PCI52** card, and everything was Ok. Actually, sometimes is hard to get real explanation in NI help and manuals.

 

Thanks!

0 Kudos
Message 10 of 11
(7,006 Views)