Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting timeout for NI-6537 Async Read

Hi all,

I am trying to set a timeout (if possible) to the async reading of digital input for the PICe 6537 card and by timeout I mean how long it waits when there is no changes before an exception is thrown. Currently my setup is that I have a client which creates a graph out of the information sent to it by the .NET app which is on the pc where the card is connected.  I would like to know if it’s possible to set a timeout when you start a digital async read (i.e. how long it should wait with no activity before throwing an exception).  Currently it is about 10 seconds before it throws an exception (i.e. no lines have changed) however I would like to change that to a value which is given to me like 5 seconds or 2 seconds when the win32 app is started. 

I have tried to change the amount of samples it takes per channels and even the sampling mode to Finite Samples within the ConfigureChangeDetection method but I have had no luck (it still times out after 10 seconds of no activity).

In case it isn't clear i am only doing digital IO.  Any ideas?

Thanks David

Edit: I have found the thread for this (The timeout method was in the task's stream)


Message Edited by Dave_UQ on 08-03-2008 04:30 AM
0 Kudos
Message 1 of 4
(3,767 Views)
Hi Dave,

The DAQmxRead function call has a timeout parameter which you can set to determine the amount of time the read will wait to read the samples.  All you need to do is pass in a number in seconds for the timeout.  In addition, passing a "-1" will result in a wait forever.  Is this what you're looking for?

Regards,
Paul C.
0 Kudos
Message 2 of 4
(3,742 Views)
Hi Paul,

Yes that is what i was after.  Just another quick question, if i stop a task with task.Control(taskAction.Stop) if the exception within the Async read starts another read (i.e. the begin read call again) do i have to start the task again with the control? (i.e. taskAction.Start)

Thanks David
0 Kudos
Message 3 of 4
(3,739 Views)
Hi David,

Yes, you can call a read after stopping the task.  However, you lose all the data after you stop the task.  This means that if you would like to read new data you must restart the task and call the read after the restart.

I hope this helps,
Paul C.
0 Kudos
Message 4 of 4
(3,721 Views)