字节序代表什么意思?
主要软件: LabVIEW Development Systems>>LabVIEW Full Development System
主要软件版本: 7.1
主要软件修正版本: N/A
次要软件: 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
问题: 我看到在一些范例程序中出现了
小端序和大端序,这里的的字节序表示什么意思?
解答: endian表示的是多字节二进制数是怎么存储的。
例如说,双字节可以存储为大端序格式(MSB LSB) 或者小端序格式(LSB MSB),MSB存储的是最高有效字节而LSB存储的是最低有效字节。例如说你想使用双字节来存储数字1,那么你可以将最高有效字节放在前面 (00000000 00000001),此时最左边的比特表示的是2^15;或者你可以将最低有效位字节放在前面,此时最左边的比特表示的是2^7。根据你使用的应用对二进制数的理解,你可以将00000001 00000000读为1,或者你可以将其读为256,下面是这两种存储的例子。
需要注意的是无论是整形,双精度或者是数组,字节序都用相同的规则组织数据,都是分为大端序或者小端序。所以,当你读取小端序数据类型同时需要将其转换为大端序,反之亦然。你可以使用labview中的Swap Bytes VI。
使用Labview 8,Flatten to String, Unflatten From Sting, Write to Binary File, and Read Binary File VIs的
byte order输入端允许你去选择字节序.
Labview使用大端序格式去处理和存储多字节数据,即便是在Windows(x86)平台上。小端序是基于因特尔x86处理器的选择,摩托罗拉处理器(包括Macintosh电脑,Labview一开始是为之开发的) 使用的是大端序。需要注意的是C和其他的Windows应用都是期待数据使用小端序来表示的。
相关链接: Developer Zone Tutorial: Introduction to LabVIEW Data Storage VI'sKnowledgeBase 10U39NAQ: Writing Binary Files with LabVIEW That Can Be Read by Other Applications
KnowledgeBase 2MKB41DV: How Can I Read the Binary Representation of a Floating Point Number in LabVIEW?
附件:
报告日期: 05/31/2000
最近更新: 02/27/2014
文档编号: 1XU8RQPH
Other Support Options
Ask the NI Community
Collaborate with other users in our discussion forums
Request Support from an Engineer
A valid service agreement may be required, and support options vary by country.