<?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: Overwrite byte array in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328618#M976166</link>
    <description>&lt;P&gt;Since you are apparently dealing with binary data instead of ASCII, you want to turn off the termination character.&amp;nbsp; I also recommend using the Bytes At Port to detect if a message has started.&amp;nbsp; If it hasn't, wait for something like 100ms.&amp;nbsp; This will make your stop button more responsive and avoid those timeout issues.&amp;nbsp; And since it looks like you are expecting 10 bytes in a message, just read the 10 bytes.&lt;/P&gt;</description>
    <pubDate>Fri, 29 Jul 2016 02:27:14 GMT</pubDate>
    <dc:creator>crossrulz</dc:creator>
    <dc:date>2016-07-29T02:27:14Z</dc:date>
    <item>
      <title>Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327664#M975838</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please see me attached code, where i am receiving serial data, converting it into a byte array and will be using a state machine to process it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am writing the data into an array and also displaying it via a string indicator. In order for the data to remain on the screen, I have used a feedback node. However, this means the data is appended everytime it is sent (at 10 second intervals). How can i get the data to remain on the screen when sent, and then be over written once new data is received, both in the indicator and the array??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 15:11:49 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327664#M975838</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-27T15:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327690#M975849</link>
      <description>&lt;P&gt;First, don't use bytes at port.&amp;nbsp; You have enabled a termination character of a line feed, so rely on that.&amp;nbsp; Just read a large number of bytes.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, in your code, put the concatenation and building of an array in a case structure.&amp;nbsp; If the number of bytes read is zero, do nothing.&amp;nbsp; If &amp;gt;0, then do the concatenation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Third, check spelling.&amp;nbsp; "Received" not "recieved".&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 15:35:56 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327690#M975849</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2016-07-27T15:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327778#M975875</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much for your reply..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I dont fully understand the theory behind placing the concat strings + building array in a case structure? What will this achieve ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 17:25:22 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327778#M975875</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-27T17:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327790#M975878</link>
      <description>&lt;P&gt;Did you understand the bit about reading, say, 1000 characters? &amp;nbsp;If you (a) specify Enable Termination Character (which you did), (b) specify the&amp;nbsp;&lt;U&gt;correct&lt;/U&gt; termination character for your device, and (c) have a "reasonable" Timeout (which you do), then if your expected VISA "message" is less than 1000 characters, you will "pause" in the VISA Read until the entire however-many-characters have been read, or no Termination Character was received (and nothing is returned).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Assume you got a legitimate String (read the Help to see how to tell if this is so). &amp;nbsp;If so, you have ... a String. &amp;nbsp;You can put it in a String indicator (no need for a feedback loop), and can use String to Byte Array to convert the entire String to Bytes. &amp;nbsp;You'll then loop, waiting for the next VISA read to complete.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bob Schor&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2016 17:42:51 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327790#M975878</guid>
      <dc:creator>Bob_Schor</dc:creator>
      <dc:date>2016-07-27T17:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327984#M975949</link>
      <description>&lt;P&gt;Let's take a step back before we progress any further down this rabbit hole.&amp;nbsp; What are you trying to communicate with and what is the protocol of the messages being sent back and forth?&amp;nbsp; This does make a huge difference in how you should approach the problem.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 01:35:18 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3327984#M975949</guid>
      <dc:creator>crossrulz</dc:creator>
      <dc:date>2016-07-28T01:35:18Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328004#M975952</link>
      <description>Thanks for the repays so far everyone!!&lt;BR /&gt;&lt;BR /&gt;I'm communicating with a power supply unit which sends out a very basic stream of data (consisting of mainly flags). It's a burst of data which occurs at 10 second intervals consisting of one start bit, one stop bit and a varie data length between.. Usually 8 bits. It's all in house protocol which has been used for years</description>
      <pubDate>Thu, 28 Jul 2016 05:06:40 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328004#M975952</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-28T05:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328029#M975960</link>
      <description>&lt;P&gt;Please ignore my spelling... it was early.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;replies*&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;varying*&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 06:58:55 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328029#M975960</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-28T06:58:55Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328038#M975964</link>
      <description>&lt;P&gt;Okay this seems to be displaying as i would like, but i can't stop the program!!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;help please.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 07:29:00 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328038#M975964</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-28T07:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328113#M975997</link>
      <description>&lt;P&gt;Anyone konw how to get round this? I have tried a few more methods but cannot get ther result I need. As stated, the data is now being displayed as i would like i.e. updating each time it is sent. However, I cannot stop the loop as it seems to be stuck in the read state ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;once again help appreciated&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 10:51:32 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328113#M975997</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-28T10:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328204#M976022</link>
      <description>&lt;P&gt;Not sure what you are talking about here.&amp;nbsp; There is no "read state".&amp;nbsp; You have a while loop.&amp;nbsp; Inside of that it does the reading.&amp;nbsp; The way to stop the while loop is to press the stop button like you have it wired up.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So where are you stuck?&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 13:42:39 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328204#M976022</guid>
      <dc:creator>RavensFan</dc:creator>
      <dc:date>2016-07-28T13:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328226#M976028</link>
      <description>&lt;P&gt;The problem is.. when i press stop, the program does not stop!!&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 14:27:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328226#M976028</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-28T14:27:34Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328241#M976036</link>
      <description>&lt;P&gt;Have you waited ten seconds for the next Read to complete? There does not appear to be anything in &amp;nbsp;your VI that would prevent it from stopping. Dataflow will not let it stop until the VISA Read completes or times out. &amp;nbsp;The Byte to Double subVI is missing but that seems unlikely to be the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lynn&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 14:41:26 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328241#M976036</guid>
      <dc:creator>johnsold</dc:creator>
      <dc:date>2016-07-28T14:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328258#M976043</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If i hold down the stop button&amp;nbsp;for ten seconds (it pops back out on its own accord before this time).. then yes the program does indeed stop.. so this is the problem. How can i get around this ? Furthermore, i get the time out error message when the progam does finally stop!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 14:56:23 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328258#M976043</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-28T14:56:23Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328271#M976047</link>
      <description>&lt;P&gt;Richard,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to learn how the LabVIEW dataflow paradigm works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within your while loop anything which does not depend on anything else may run in parallel. So the Stop button and all the other code are parallel. This effectively means that the Stop button will be read at the very beginning of each iteration. Because the mechanical action for the Stop button is set to Latch When Released, it will pop back out as soon as it is read. But the rest of the code, particularly the VISA Read will take about 10 seconds. The while loop will not decide whether to stop or not until everything inside has completed. So, even though the Stop button may have been read seconds ago, the loop will not stop until after the Read. &amp;nbsp;Holding the button down should not make any difference. Once it has been read the value will remain on the wire going to the loop termination terminal until the next iteration.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can you get around it? You need to make everything else in the loop take less time. But shortening the timeout on the VISA Read may cause problems with getting your data since the device only sends data once every 10 seconds. &amp;nbsp;There are ways to work around that but they can get complicated and the details depend on how the data coming on the serial port is formatted and how you will handle partial messages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lynn&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 15:13:52 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328271#M976047</guid>
      <dc:creator>johnsold</dc:creator>
      <dc:date>2016-07-28T15:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328285#M976050</link>
      <description>&lt;P&gt;Thanks again for your reply,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will continue tomorrow. Should i be going down a producer/ consumer route ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Richard.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 15:28:37 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328285#M976050</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-28T15:28:37Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328289#M976053</link>
      <description>&lt;P&gt;A producer/consumer architecture might be useful in decoding the partial messages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lynn&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jul 2016 15:36:25 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328289#M976053</guid>
      <dc:creator>johnsold</dc:creator>
      <dc:date>2016-07-28T15:36:25Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328618#M976166</link>
      <description>&lt;P&gt;Since you are apparently dealing with binary data instead of ASCII, you want to turn off the termination character.&amp;nbsp; I also recommend using the Bytes At Port to detect if a message has started.&amp;nbsp; If it hasn't, wait for something like 100ms.&amp;nbsp; This will make your stop button more responsive and avoid those timeout issues.&amp;nbsp; And since it looks like you are expecting 10 bytes in a message, just read the 10 bytes.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 02:27:14 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328618#M976166</guid>
      <dc:creator>crossrulz</dc:creator>
      <dc:date>2016-07-29T02:27:14Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328637#M976171</link>
      <description>&lt;P&gt;You can also use 'Enable Event' with event type being your Serial TermChar and then 'Wait for Event' in your while loop with a small timeout.&lt;/P&gt;&lt;P&gt;So, you will read the available bytes only when your event is generated that would prevent unnecessary polling.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Runjhun&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 03:31:27 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328637#M976171</guid>
      <dc:creator>RJ_15</dc:creator>
      <dc:date>2016-07-29T03:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328638#M976172</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/203142"&gt;@RJ_15&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;So, you will read the available bytes only when your event is generated that would prevent unnecessary polling.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;That is still technically polling (wait for event, timed out, try again, timed out, etc.) and I have found it to add unneccessary complication.&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 03:34:33 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328638#M976172</guid>
      <dc:creator>crossrulz</dc:creator>
      <dc:date>2016-07-29T03:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Overwrite byte array</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328700#M976183</link>
      <description>&lt;P&gt;Thanks everyone for their input in this.. Im learning lots and really appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Crossrulz thanks very much for taking the time to make that program. Perfect thankyou!!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Jul 2016 08:10:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Overwrite-byte-array/m-p/3328700#M976183</guid>
      <dc:creator>lvrichard</dc:creator>
      <dc:date>2016-07-29T08:10:34Z</dc:date>
    </item>
  </channel>
</rss>

