<?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: Endian Conversion? in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149969#M89757</link>
    <description>Well thanks to a few folks on info-labview mailing list, we have an even easier method:&lt;BR /&gt;&lt;BR /&gt;Byte swap, then word swap. This will reverse all the bytes in the I32. Also, if you read the help on these fxs, they appear to be polymorphic and would therefore be quite versatile.&lt;BR /&gt;&lt;BR /&gt;Don &lt;BR /&gt;</description>
    <pubDate>Tue, 24 Aug 2004 18:56:06 GMT</pubDate>
    <dc:creator>DonRoth</dc:creator>
    <dc:date>2004-08-24T18:56:06Z</dc:date>
    <item>
      <title>Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149961#M89749</link>
      <description>I am importing an NDF data file using labview read file VIs.  The header of this file is composed of various strings and I32 type values.  The strings read in fine.  When attempting to read the I32 type, I am getting incorrect numbers. (I specify I32 type for the input on the Read file fx.) For example, header size should be '2048' but I am getting '524288'.  Data Points should be '1024' but I am getting '262144.'  I was told I need to convert to little endian format. Byte swapping is trivial for I16/U16 but it is not clear how to attack this with I32 type.   Given that we know what the values should be, I was hoping to be able to reverse engineer this somehow.  I attempted various byte operations from the labview data manipulation palette with no succ&lt;BR /&gt;ess. Any advise here is appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Don &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 15:07:31 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149961#M89749</guid>
      <dc:creator>DonRoth</dc:creator>
      <dc:date>2004-08-24T15:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149962#M89750</link>
      <description>Convert the number to boolean array, reverse the array, convert back to number.  All are primitive functions and, I think, work in place (meaning they do not create copies) and should be quite fast.&lt;BR /&gt;&lt;BR /&gt;Byte swapping does not reverse the individual bits within each byte.&lt;BR /&gt;&lt;BR /&gt;Lynn &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 15:29:07 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149962#M89750</guid>
      <dc:creator>johnsold</dc:creator>
      <dc:date>2004-08-24T15:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149963#M89751</link>
      <description>Hi Don&lt;BR /&gt;&lt;BR /&gt;This VI (takes your number and write them in digital format) will show you what your proble is.&lt;BR /&gt;&lt;BR /&gt;Either you have a 8 bits shift in your readings, either you have to rotate some byte.&lt;BR /&gt;&lt;BR /&gt;As there are several solutions, I am quite shure that with the toll provided you will get it clear&lt;BR /&gt;&lt;BR /&gt;Doc-Doc &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 15:31:17 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149963#M89751</guid>
      <dc:creator>DOC-doc</dc:creator>
      <dc:date>2004-08-24T15:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149964#M89752</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;You have the solution for I32.&lt;BR /&gt;Labview is Big Endian, so perhaps you should take a look at this link to learn how to convert other numeric types from/to any endian&lt;BR /&gt;http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/97332426d63630ee862565070049ffbb?OpenDocument&lt;BR /&gt;Hope it helps&lt;BR /&gt;Alipio &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 15:40:34 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149964#M89752</guid>
      <dc:creator>alipio</dc:creator>
      <dc:date>2004-08-24T15:40:34Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149965#M89753</link>
      <description>While there may be a more efficient way, I have done the byte &lt;BR /&gt;rearrangement by taking the input to "Flatten to String", then "String &lt;BR /&gt;to byte array", then "Reverse 1D array", then "byte array to string", &lt;BR /&gt;and finally "Unflatten from string" with the type wired to, in my case, &lt;BR /&gt;U32. I presume this would also work for signed values by wiring type to I32.&lt;BR /&gt;&lt;BR /&gt;DonRoth wrote:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I am importing an NDF data file using labview read file VIs.  The&lt;BR /&gt;&amp;gt; header of this file is composed of various strings and I32 type&lt;BR /&gt;&amp;gt; values.  The strings read in fine.  When attempting to read the I32&lt;BR /&gt;&amp;gt; type, I am getting incorrect numbers. (I specify I32 type for the&lt;BR /&gt;&amp;gt; input on the Read file fx.) For example, header size should be '2048'&lt;BR /&gt;&amp;gt; but I am getting '524288'.  Data Points should be '1024'&lt;BR /&gt; but I am&lt;BR /&gt;&amp;gt; getting '262144.'  I was told I need to convert to little endian&lt;BR /&gt;&amp;gt; format. Byte swapping is trivial for I16/U16 but it is not clear how&lt;BR /&gt;&amp;gt; to attack this with I32 type.   Given that we know what the values&lt;BR /&gt;&amp;gt; should be, I was hoping to be able to reverse engineer this somehow.&lt;BR /&gt;&amp;gt; I attempted various byte operations from the labview data manipulation&lt;BR /&gt;&amp;gt; palette with no success. Any advise here is appreciated.&lt;BR /&gt;&amp;gt; &lt;BR /&gt;&amp;gt; Thanks,&lt;BR /&gt;&amp;gt; &lt;BR /&gt;&amp;gt; Don &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 16:06:58 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149965#M89753</guid>
      <dc:creator>DEM@ORNL</dc:creator>
      <dc:date>2004-08-24T16:06:58Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149966#M89754</link>
      <description>Someone correct me if I am wrong, but I think that Big/Little Endian has to do with byte order, not bit order.  If so, there is no need to convert numbers to bits and reverse their order.  The split number and join number functions (Advanced - Data Manipulation - Split Number, Join Number), does an easy job of splitting words and bytes and joining bytes and words.  To convert from one endian to another, split the number down to 8 bit sections, then join back together in reverse order.  See the attached example.  The numeric control and indicator are set for hex display in order to easily see the byte splitting/joining.  If you change from hex to decimal display and enter 2048, you will see an output of 524288, and vice versa.  This conversion vi could be ma&lt;BR /&gt;de more simple by eliminating the intermediate numerical indicators.  I put them here for illustration.  This should be an easy fix for your problem.  It will convert from one endian case to the other, doesn't matter which case is the input. &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 16:48:08 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149966#M89754</guid>
      <dc:creator>tbob</dc:creator>
      <dc:date>2004-08-24T16:48:08Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149967#M89755</link>
      <description>Hi tbob&lt;BR /&gt;You are right if working wwith integers(I16,U16,I32,U32) but little endian/big endian also applies to float  (SGL,DBL,....) so, in this case, the Typecast to U8 array, reverse array and typecast back to float type is the best choice in Labview, I think.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Alipio &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 17:45:08 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149967#M89755</guid>
      <dc:creator>alipio</dc:creator>
      <dc:date>2004-08-24T17:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149968#M89756</link>
      <description>Well thanks to George Gatling, he suggested something I had not tried yet regarding reversing the bytes and it works.  Here is his solution:&lt;BR /&gt;&lt;BR /&gt;You can use the "Split Number" and "Join Number" function on the data manipulation palette to accomplish this.  Split the I32 once to get I16 and then split each I16 once to get four I8.  Then join the numbers back together in the reverse order (ie with the highest source byte as the lowest target byte).  And this will do the trick! &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 18:27:37 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149968#M89756</guid>
      <dc:creator>DonRoth</dc:creator>
      <dc:date>2004-08-24T18:27:37Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149969#M89757</link>
      <description>Well thanks to a few folks on info-labview mailing list, we have an even easier method:&lt;BR /&gt;&lt;BR /&gt;Byte swap, then word swap. This will reverse all the bytes in the I32. Also, if you read the help on these fxs, they appear to be polymorphic and would therefore be quite versatile.&lt;BR /&gt;&lt;BR /&gt;Don &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 18:56:06 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149969#M89757</guid>
      <dc:creator>DonRoth</dc:creator>
      <dc:date>2004-08-24T18:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149970#M89758</link>
      <description>Based on our discussions, I just put a byte swapper together for dbl type if anyone wants it.  A general byte swapper can be envisioned with a case for each class (I32, I64, dbl, sgl, array? etc.) by programatically obtaining the cases from the classID or typedescriptor. What I did for the dbl type was first typecast it into I32 array and then do the byte swap word swap procedure, followed by rebuilding array, reversing array, and retypecasting back to dbl..Don &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 19:40:53 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149970#M89758</guid>
      <dc:creator>DonRoth</dc:creator>
      <dc:date>2004-08-24T19:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149971#M89759</link>
      <description>DonRoth wrote:&lt;BR /&gt;&amp;gt; Based on our discussions, I just put a byte swapper together for dbl&lt;BR /&gt;&amp;gt; type if anyone wants it.  A general byte swapper can be envisioned&lt;BR /&gt;&amp;gt; with a case for each class (I32, I64, dbl, sgl, array? etc.) by&lt;BR /&gt;&amp;gt; programatically obtaining the cases from the classID or&lt;BR /&gt;&amp;gt; typedescriptor. What I did for the dbl type was first typecast it into&lt;BR /&gt;&amp;gt; I32 array and then do the byte swap word swap procedure, followed by&lt;BR /&gt;&amp;gt; rebuilding array, reversing array, and retypecasting back to dbl..Don&lt;BR /&gt;&lt;BR /&gt;Using the previously mentioned Byte Swap and Word Swap together should &lt;BR /&gt;do the right (TM) thing for all possible LabVIEw data types including &lt;BR /&gt;when you apply it to a cluster with all kinds of data types in it.&lt;BR /&gt;&lt;BR /&gt;Rolf Kalbermatter &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 20:37:37 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149971#M89759</guid>
      <dc:creator>rolfk</dc:creator>
      <dc:date>2004-08-24T20:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149972#M89760</link>
      <description>I thought so to. But, I tested doing just that for a dbl and it did not produce the correct result. It seems to me you have to break it down to to 4 byte packets first (from the 8-byte dbl) which is what I did in my code and then the correct result is produced.&lt;BR /&gt;&lt;BR /&gt;I think to get it to work in the same fashion as you are thinking, you would need also a 'swap double word' fx also....&lt;BR /&gt;&lt;BR /&gt;Don &lt;BR /&gt;</description>
      <pubDate>Tue, 24 Aug 2004 21:42:25 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149972#M89760</guid>
      <dc:creator>DonRoth</dc:creator>
      <dc:date>2004-08-24T21:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149973#M89761</link>
      <description>Hi all&lt;BR /&gt;Ineresting some of the procedures.&lt;BR /&gt;I found this vi - old one from NI examples- that ilustrates some procedures to change endian&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Alipio &lt;BR /&gt;</description>
      <pubDate>Wed, 25 Aug 2004 05:47:56 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149973#M89761</guid>
      <dc:creator>alipio</dc:creator>
      <dc:date>2004-08-25T05:47:56Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149974#M89762</link>
      <description>I just downloaded and looked at the VI. I'm starting to think that if you don't have an array where the word and byte swap fxs are directly applicable, the method you proposed of first typecasting to U8 array, then reversing array, and retypecasting back to the original type, is probably best most general method and a polymorphic VI could be made....Don &lt;BR /&gt;</description>
      <pubDate>Wed, 25 Aug 2004 12:27:36 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/149974#M89762</guid>
      <dc:creator>DonRoth</dc:creator>
      <dc:date>2004-08-25T12:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Endian Conversion?</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/376250#M188994</link>
      <description>&lt;DIV&gt;&lt;/DIV&gt;Why not just flatten to string, reverse string, and unflatten from string?&amp;nbsp; I would think this would be the quickest way for scalars.</description>
      <pubDate>Thu, 08 Jun 2006 17:46:30 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Endian-Conversion/m-p/376250#M188994</guid>
      <dc:creator>eye_in_the_sky</dc:creator>
      <dc:date>2006-06-08T17:46:30Z</dc:date>
    </item>
  </channel>
</rss>

