<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Asynchronous Conter Read in Measurement Studio for .NET Languages</title>
    <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/515754#M5145</link>
    <description>&lt;P class="MsoNormal"&gt;Joe,&lt;/P&gt;



&lt;P class="MsoNormal"&gt;If you would like phone support, you may call 1-866-IEEE-488 (433-3488).
Our sales team will help in getting you the best support for this issue.&lt;/P&gt;

&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 02 May 2007 19:19:39 GMT</pubDate>
    <dc:creator>David L.</dc:creator>
    <dc:date>2007-05-02T19:19:39Z</dc:date>
    <item>
      <title>Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/509039#M5058</link>
      <description>&lt;DIV&gt;i have written a program in vb.net and would like to capture 14 different times.&amp;nbsp; I would like to do an asynchronous read for each counter because each counter will give me random times.&amp;nbsp; I will use the CounterReader.&lt;FONT size="2"&gt;BeginReadSingleSampleDouble(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;AddressOf&lt;/FONT&gt;&lt;FONT size="2"&gt; OnDataReady, Nothing)&lt;/FONT&gt;.&amp;nbsp; I am having a problem with being able to distinguish one couter time from another.&amp;nbsp; Being that the timers may not always finish in the same order i will have to keep track of each time some how.&amp;nbsp; My question is how will the OnDataReady function know which time goes with which variable.&amp;nbsp; I know that i have to put an object in where "Nothing" is but i'm not sure on how to do that and then confirm that the correct times match up with the correct timer. &lt;/DIV&gt;</description>
      <pubDate>Wed, 18 Apr 2007 18:03:00 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/509039#M5058</guid>
      <dc:creator>joe shmo</dc:creator>
      <dc:date>2007-04-18T18:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/509819#M5059</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;I think you can check the virtual channel name to determine which counter channel has returned with a value. If I have read my documentation correctly, if you don't set the virtual name, then the physical name will also become the virtual name and so you should be able to test to that.&lt;BR /&gt;&lt;BR /&gt;Could be wrong though as I can't consistently get a value back for my counters....&lt;BR /&gt;&lt;BR /&gt;cm&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 19 Apr 2007 20:35:23 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/509819#M5059</guid>
      <dc:creator>Kaxten</dc:creator>
      <dc:date>2007-04-19T20:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/509916#M5061</link>
      <description>&lt;P class="MsoNormal"&gt;Joe,&lt;/P&gt;





&lt;P class="MsoNormal"&gt;What hardware are you using, and can you please elaborate on
’14 different times’. Does this mean you want to capture one counter 14
different times, a different counter each time for 14 times, etc?&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/P&gt;

&lt;P class="MsoNormal"&gt;You can find a good shipping example here: &lt;SPAN style="color: black;"&gt;C:\Program Files\National
Instruments\MeasurementStudioVS2005\DotNET\Examples\DAQmx\Counter\Count Digital
Events\CountDigEventsBuffContinuous_ExtClk\vb&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;



&lt;P class="MsoNormal"&gt;&lt;SPAN style="color: black;"&gt;The counter data will be put into
an array, which is obtained during the function callback of B&lt;/SPAN&gt;&lt;SPAN class="noindex"&gt;eginReadSingleSampleDouble(). More information on how the counter
data is put into this array can be found in the help file.&lt;/SPAN&gt;&lt;SPAN style="color: black;"&gt; For the program above, the counter data is obtained and
then the callback function is called. Inside that callback function, it reads
the counters again and calls itself. This makes it a continuous loop.&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;/P&gt;

&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 20 Apr 2007 03:09:14 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/509916#M5061</guid>
      <dc:creator>David L.</dc:creator>
      <dc:date>2007-04-20T03:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/512549#M5097</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;I have 2 PCI-6602 boards and am using 14 different counters.&amp;nbsp; The problem is that counter 1 through 14 should be tripped in order, but if they are not or if one counter is not tripped at all then i would like to disregard the counter that is not tripped.&amp;nbsp; The program that i have written works if all the counters are tripped.&amp;nbsp; The problem is if one is missed.&amp;nbsp; If one is misssed then the response time of the program is extremly slow and unreliable.&amp;nbsp; I am using the BeginReadSampleDouble&amp;nbsp;method of CounterReader&amp;nbsp;and calling the&amp;nbsp;method EndReadSingleSampleDouble()&amp;nbsp;to receive the data and ends the read.&amp;nbsp; The problem is if one of the counters is not tripped then it never&amp;nbsp;ends the read.&amp;nbsp; So what i do is wait in a loop&amp;nbsp;to until at least one of the 14 counters is tripped and then i wait 2 seconds.&amp;nbsp; *I am&amp;nbsp;not sure what the time is for each counter, but what is do know is that it will not take more than 0.75 second for the last counter to be tripped.&amp;nbsp; So by waiting 2 seconds i should have gotten all of the couters&amp;nbsp;that were tripped, and if&amp;nbsp;any are not tripped then i set the variable pertaining to&amp;nbsp;that counter to -1.&amp;nbsp; After all the counter&amp;nbsp;stopped and read for the times all of the task must be stopped and disposed of.&amp;nbsp; This is were the problem occurs.&amp;nbsp; I a&amp;nbsp;counter is not tripped then when is gets to the&amp;nbsp;routine where the&amp;nbsp;task are stopped and&amp;nbsp;disposed then it seems to lock up or take very&amp;nbsp;long to occur.&amp;nbsp; So what i really need to know is how do i stop a BeginReadSingleSampleDouble or set a time out for it.&amp;nbsp; Below is the code.&amp;nbsp;&lt;/P&gt;&lt;FONT color="#0000ff" size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&amp;nbsp;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2007 18:39:19 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/512549#M5097</guid>
      <dc:creator>joe shmo</dc:creator>
      <dc:date>2007-04-25T18:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/512550#M5098</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Private&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Sub&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt; measureButton_Click(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;ByVal&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt; sender &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt; System.Object, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;ByVal&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt; e &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT color="#000000" size="2"&gt; System.EventArgs) &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Handles&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt; measureButton.Click &lt;/FONT&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT size="2"&gt; i &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Integer&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;SaveLabel.Visible = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;False&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Try&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;measureButton.Enabled = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;False&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Call&lt;/FONT&gt;&lt;FONT size="2"&gt; SetUpArray()&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'setup timing parameters&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT size="2"&gt; MinTime &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Double&lt;/FONT&gt;&lt;FONT size="2"&gt; = 0.000001 &lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'this is the minimum time to count&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT size="2"&gt; MaxTime &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Double&lt;/FONT&gt;&lt;FONT size="2"&gt; = 2 &lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'this is the maximum time to wait for a signal&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'Clear all times &lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;For&lt;/FONT&gt;&lt;FONT size="2"&gt; i = 1 &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;To&lt;/FONT&gt;&lt;FONT size="2"&gt; 14&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Times(i) = 0&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Next&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'Create task, configure, and start each task. 1 channel per task &lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;For&lt;/FONT&gt;&lt;FONT size="2"&gt; i = 1 &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;To&lt;/FONT&gt;&lt;FONT size="2"&gt; 14&lt;P&gt;&lt;/P&gt;
&lt;P&gt;TaskNum(i) = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;New&lt;/FONT&gt;&lt;FONT size="2"&gt; Task&lt;P&gt;&lt;/P&gt;
&lt;P&gt;TaskNum(i).CIChannels.CreateTwoEdgeSeparationChannel(DeviceName(i), _&lt;/P&gt;
&lt;P&gt;"", MinTime, MaxTime, CITwoEdgeSeparationFirstEdge.Rising, CITwoEdgeSeparationSecondEdge.Rising, _&lt;/P&gt;
&lt;P&gt;CITwoEdgeSeparationUnits.Seconds)&lt;/P&gt;
&lt;P&gt;TaskNum(i).Start()&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Next&lt;/FONT&gt;&lt;FONT size="2"&gt; i&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;For&lt;/FONT&gt;&lt;FONT size="2"&gt; i = 1 &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;To&lt;/FONT&gt;&lt;FONT size="2"&gt; 14&lt;P&gt;&lt;/P&gt;
&lt;P&gt;StartRead(TaskNum(i), i)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Next&lt;/FONT&gt;&lt;FONT size="2"&gt; (i)&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT size="2"&gt; GotSomeTimes &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Boolean&lt;/FONT&gt;&lt;FONT size="2"&gt; = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;False&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Do&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Until&lt;/FONT&gt;&lt;FONT size="2"&gt; GotSomeTimes&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DoEvents()&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;For&lt;/FONT&gt;&lt;FONT size="2"&gt; i = 1 &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;To&lt;/FONT&gt;&lt;FONT size="2"&gt; 14&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;FONT size="2"&gt; Times(i) &amp;lt;&amp;gt; 0 &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Then&lt;/FONT&gt;&lt;FONT size="2"&gt; GotSomeTimes = &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;True&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Next&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Loop&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT color="#008000" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size="2"&gt;&lt;FONT color="#000000"&gt;Time1 = Now.Second &lt;/FONT&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Delay = 2&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;FONT size="2"&gt; Time1 &amp;gt;= 60 - Delay &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Then&lt;/FONT&gt;&lt;FONT size="2"&gt; Time1 = 0&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Do&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Until&lt;/FONT&gt;&lt;FONT size="2"&gt; Now.Second &amp;gt;= Time1 + Delay&lt;P&gt;&lt;/P&gt;
&lt;P&gt;DoEvents()&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Loop&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'If a screen is not tripped then return (-1)&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;For&lt;/FONT&gt;&lt;FONT size="2"&gt; i = 1 &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;To&lt;/FONT&gt;&lt;FONT size="2"&gt; 14&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;If&lt;/FONT&gt;&lt;FONT size="2"&gt; Times(i) = 0 &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Then&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;Times(i) = -1&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT size="2"&gt; ReadIn &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;String&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;If&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Next&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'display values&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'Error Handeling sequence&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Catch&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT size="2"&gt; exception &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; DaqException&lt;P&gt;&lt;/P&gt;
&lt;P&gt;MessageBox.Show(Exception.Message)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Finally&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'this will end all task&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;For&lt;/FONT&gt;&lt;FONT size="2"&gt; i = 1 &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;To&lt;/FONT&gt;&lt;FONT size="2"&gt; 14&lt;P&gt;&lt;/P&gt;
&lt;P&gt;TaskNum(i).Stop()&lt;/P&gt;
&lt;P&gt;TaskNum(i).Dispose()&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Next&lt;/FONT&gt;&lt;FONT size="2"&gt; i&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;measureButton.Enabled = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;True&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Try&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Sub&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Public&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Sub&lt;/FONT&gt;&lt;FONT size="2"&gt; StartRead(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;ByVal&lt;/FONT&gt;&lt;FONT size="2"&gt; t &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; Task, &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;ByVal&lt;/FONT&gt;&lt;FONT size="2"&gt; i &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Integer&lt;/FONT&gt;&lt;FONT size="2"&gt;)&lt;P&gt;&lt;/P&gt;
&lt;P&gt;counterInReader(i) = &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;New&lt;/FONT&gt;&lt;FONT size="2"&gt; CounterReader(t.Stream)&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;Dim handle as &lt;FONT size="2"&gt;IAsyncResult&lt;/FONT&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;handle&amp;nbsp;= counterInReader(i).BeginReadSingleSampleDouble(&lt;FONT color="#0000ff" size="2"&gt;AddressOf&lt;/FONT&gt;&lt;FONT size="2"&gt; OnDataReady, i)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Sub&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Public&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Sub&lt;/FONT&gt;&lt;FONT size="2"&gt; OnDataReady(&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;ByVal&lt;/FONT&gt;&lt;FONT size="2"&gt; x &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; IAsyncResult)&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Dim&lt;/FONT&gt;&lt;FONT size="2"&gt; ReadIn &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;As&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;String&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;ReadIn = x.AsyncState &lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'this is the value of the second parameter for function BeginReadSingleSampleDouble&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;'This is how the function distinguishes between async. responses.&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;Times(ReadIn) = counterInReader(ReadIn).EndReadSingleSampleDouble(x)&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;End&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Sub&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Sub&lt;/FONT&gt;&lt;FONT size="2"&gt; SetUpArray()&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT size="2"&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;
&lt;P&gt;&lt;FONT color="#008000" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;/FONT&gt;&lt;/P&gt;End&lt;FONT color="#000000" size="2"&gt; &lt;/FONT&gt;&lt;FONT color="#0000ff" size="2"&gt;Class
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#000000" size="3"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Apr 2007 18:41:26 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/512550#M5098</guid>
      <dc:creator>joe shmo</dc:creator>
      <dc:date>2007-04-25T18:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/512693#M5102</link>
      <description>&lt;P class="MsoNormal"&gt;You can use a timeout in order to prevent the program from
waiting a long time until you get a tripped timer. The timeout property is set
by getting a Stream object from your Task, and then setting the Timeout
property of Stream.&lt;/P&gt;

&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 25 Apr 2007 22:42:28 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/512693#M5102</guid>
      <dc:creator>David L.</dc:creator>
      <dc:date>2007-04-25T22:42:28Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/513654#M5123</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;David,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help it was useful.&amp;nbsp; It works much better but is inconsistent.&amp;nbsp; Sometimes the program will get stuck on the task.stop if a time is not received, but the task.stream.timeout should have taken care of that.&amp;nbsp; I have a question.&amp;nbsp;The help file says &lt;STRONG&gt;"Gets or sets the amount of time in milliseconds to wait for reads or writes to complete." &lt;/STRONG&gt;but it doesn't say when the timeout start to count.&amp;nbsp; Is it when the read starts or when the timeout value is set?&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 27 Apr 2007 12:11:40 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/513654#M5123</guid>
      <dc:creator>joe shmo</dc:creator>
      <dc:date>2007-04-27T12:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/514702#M5133</link>
      <description>&lt;P class="MsoNormal"&gt;Joe,&lt;/P&gt;



&lt;P class="MsoNormal"&gt;The counter timeout is started when the &lt;SPAN class="noindex"&gt;BeginReadSingleSampleDouble()
is called. One recommended change to your code, I would highly recommend putting the &lt;SPAN style="color: blue;"&gt;New&lt;/SPAN&gt; CounterReader(t.Stream) in the upper while loop,
as putting it in the bottom while loop can affect the timing and contribute to
the errors you are seeing.&lt;/SPAN&gt;&lt;/P&gt;

&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 30 Apr 2007 19:08:18 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/514702#M5133</guid>
      <dc:creator>David L.</dc:creator>
      <dc:date>2007-04-30T19:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/515658#M5144</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;
&lt;P&gt;David,&lt;/P&gt;
&lt;P&gt;Thank you for the info.&lt;/P&gt;
&lt;P&gt;Unfortunatley putting the &lt;SPAN style="COLOR: blue"&gt;New&lt;/SPAN&gt; CounterReader(t.Stream) in the upper while loop did not help.&amp;nbsp; The program is still unpredictable so i went back to just doing a regual real time stream of the task and setting a timeout for the stream.&amp;nbsp; This will allow me to get all of the time if they are good, and if i miss one &lt;STRONG&gt;or more&lt;/STRONG&gt; then it will return -1 for the first counter missed and whatever counter is after the first missed counter&amp;nbsp;will also return -1.&amp;nbsp; This way i will atleast know where the first problem occured.&amp;nbsp; I will utilize the program like this for now but i am hoping to be able to get consistent reads by way of asynchronous.&amp;nbsp; The way i am doing this is that i have written a program into a basic stamp chip which spits out 14 different pulses at a know interval.&amp;nbsp; I then feed these pulses into the PCI-6602 boards.&amp;nbsp; I have no problems at all when i read &lt;STRONG&gt;all the times (14) &lt;/STRONG&gt;in using the real time read ReadSingleSampleDouble(), but when i use the&amp;nbsp;async. read&amp;nbsp;then sometimes&amp;nbsp;i miss some readings, even when&amp;nbsp;&lt;STRONG&gt;all the times(14) &lt;/STRONG&gt;are tripped.&amp;nbsp; This is to inconsistent for me to use so I would like to know if i can contact you or somebody else at National Istruments to talk to over the phone about this problem in more detail.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 02 May 2007 17:34:49 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/515658#M5144</guid>
      <dc:creator>joe shmo</dc:creator>
      <dc:date>2007-05-02T17:34:49Z</dc:date>
    </item>
    <item>
      <title>Re: Asynchronous Conter Read</title>
      <link>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/515754#M5145</link>
      <description>&lt;P class="MsoNormal"&gt;Joe,&lt;/P&gt;



&lt;P class="MsoNormal"&gt;If you would like phone support, you may call 1-866-IEEE-488 (433-3488).
Our sales team will help in getting you the best support for this issue.&lt;/P&gt;

&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 02 May 2007 19:19:39 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Measurement-Studio-for-NET/Asynchronous-Conter-Read/m-p/515754#M5145</guid>
      <dc:creator>David L.</dc:creator>
      <dc:date>2007-05-02T19:19:39Z</dc:date>
    </item>
  </channel>
</rss>

