XCP中的motorola intel字节序介绍

在Vector的XCP代码中字节序的配置代码如下:

#if defined ( XCP_CPUTYPE_BIGENDIAN )
    CRM_CONNECT_COMM_BASIC |= (vuint8)PI_MOTOROLA;
#endif

说明摩托罗拉字节序其实对应的就是大端字节序,同理intel字节序就对应于小端字节序。

 

摘录一段wiki上面对大小端的介绍:

In big-endian format, whenever addressing memory or sending/storing words bytewise, the most significant byte—the byte containing the most significant bit—is stored first (has the lowest address) or sent first, then the following bytes are stored or sent in decreasing significance order, with the least significant byte—the one containing the least significant bit—stored last (having the highest address) or sent last.

Little-endian format reverses this order: the sequence addresses/sends/stores the least significant byte first (lowest address) and the most significant byte last (highest address). Most computer systems prefer a single format for all its data; using the system's native format is automatic. But when reading memory or receiving transmitted data from a different computer system, it is often required to process and translate data between the preferred native endianness format to the opposite format.

翻译过来就是:大端格式指,在按字节存储或者发送数据时,高有意义字节会先发送或者先存储(存储时地址是由低向高增长)。比如我们发送一个32位的数0xFEBD025E,在这个32位的数中FE这个字节就是高有意义(或者高有效)字节,所以在以大端传时,FE会先发出来,然后才是BD025E,接受端在收到这个32位的数后,假设要用大端存储在flash中,那么,FE就会存在低地址处,然后地址加1存BD,依次存025E。

 

 

 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值