What Does the Term "Endian" Mean?Primary Software: LabVIEW Development Systems>>Full Development SystemPrimary Software Version: 7.1 Primary Software Fixed Version: N/A Secondary Software: Other NI Software, Calibration Executive, DIAdem, LabVIEW Toolkits, LabWindows/CVI Add-ons, Measurement Studio Add-ons, LabVIEW Modules, LabVIEW Development Systems, LabWindows/CVI Development Systems, Measurement Studio, TestStand, Lookout, MATRIXx
Problem: I saw the terms little-endian and big-endian used in a description for one of your example programs. What do you mean by endian? Solution: The term endian refers to the way that multi-byte binary numbers are stored. For example, two-byte binary numbers can be stored in big-endian format (MSB LSB) or in lilttle-endian format (LSB MSB), where MSB is the most significant byte and LSB is the least significant byte. If you wanted to store the number 1 as a two-byte binary number, then you could write it with the most significant byte first (00000000 00000001), where the left-most zero represents 2^15, or with the least significant byte first (00000001 00000000), where the left-most zero represents 2^7. Depending on the way your application interprets binary numbers, you may read (00000001 00000000) as 1, or you may read it as 256. Keep in mind that endian ordering holds true for each data type. Whether the data type is an integer, a double, or an array with one million elements, the format of storage in memory is big or little-endian for that data type. So, if you are reading a file with little-endian data and need to convert it to big-endian ordering, or vice versa, you can use the Swap Bytes VI in LabVIEW. Starting in LabView 8, the byte order input allows you to choose the desired endian order when using the Flatten to String, Unflatten From Sting, Write to Binary File, and Read Binary File VIs. LabVIEW uses the big-endian format when handling and storing multi-byte data, even on the Windows (x86) platform. Little Endian was the choice for computers based on the Intel x86 processors, while Motorola processors (including the Macintosh computer, for which LabVIEW was first developed) used big-endian. Be aware that C and other Windows applications typically expect numeric data to be in little-endian form. Related Links: Developer Zone Tutorial: LabVIEW Data Storage KnowledgeBase 10U39NAQ: Writing Binary Files with LabVIEW That Can Be Read by Other Applications KnowledgeBase 4408RRAC: What Are the Intel and Motorola Byte Orders in NI-CAN? KnowledgeBase 2MKB41DV: How Can I Read the Binary Representation of a Floating Point Number in LabVIEW? Attachments:
Report Date: 05/31/2000 Last Updated: 09/05/2008 Document ID: 1XU8RQPH |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
