关于C51中“大小端存储”问题的详解
1. Little-Endian(小端存储),即将低字节的数据存储于低地址中,Big-Endian(大端存储)反之。
2. 小端存储称为Intel模式,大端存储称为Motorola模式。
3. C51中LCALL指令将下一指令的执行地址压入堆栈中(堆栈地址由低向高增长),先存入低字节地址,再存入高字节地址,亦即使用“小端模式(Intel模式)”;除此之外,C51中的其它指令和数据,均使用“大端模式(Motorola模式)”。
The -bit machine and has no instructions bits. Multi-byte data are stored according to the following rules. The LCALL instruction stores the address of the next instruction on the stack. The address is pushed onto the stack low-order byte first. The address is, therefore, stored in memory in little endian format. All other -bit and -bit values are stored, contrary to other Intel processors, -bit addresses that are in big endian format. Floating-point numbers are stored according to the IEEE- format and are stored in big endian format with the high-order byte stored first. --引用参考:Keil Cx51 User‘s Guide -> Appendix -> E. Byte Ordering. --http://www.keil.com/support/man/docs/c51/c51_xe.htm
4. Keil编译器不能按用户需求设置大小端的存储模式。
SYMPTOMS My hardware's set up for big endian, but the compiler seems to be storing things little endian. Is there a compiler option to reverse the way data is stored? CAUSE At this time, there is no functionality in any of the compilers to effect a "global" change in the way data is stored. --引用参考:http://www.keil.com/support/docs/730.htm
5. 8051系列MCU中,用C语言进行编程时,数据的存储模式由编译器(Compiler)决定,如Keil C51 Compiler 4.0版本开始使用“大端存储模式”,而较早前的编译器版本中使用的是“小端存储模式”。
Version 4.0 Differences Home » Appendix » B. Version Differences » Version 4.0 Differences Byte Order of Floating-point Numbers Floating-point numbers are now stored in the big endian order. Previous releases of the C51 compiler stored floating-point numbers in little endian format. Refer to Floating-point Numbers for more information. --引用参考:http://www.keil.com/support/man/docs/c51/c51_xb_ver4dif.htm
6. 主流MCU架构关于endian的配置:
使用小端(Little- (including , 65C816), Z80 (including Z180, eZ80 etc.), MCS-, , DEC Alpha, Altera Nios, Atmel AVR, SuperH, VAX, 和 PDP- 等等; 使用大端(Big- and 68k, Xilinx Microblaze, IBM POWER, system/, System/ 等等。 支持配置endian的架构:如下架构有配置endian为大端、小端中任一种的功能, ARM, PowerPC, Alpha, SPARC V9, MIPS, PA-RISC 和 IA- 等等。 --引用参考:http://smilejay.com/2012/01/big-endian_little-endian/
--编者注:ARM架构中,可通过对功能寄存器进行设置,从而切换至Big-Endian或Small-Endian存储模式。
关于C51中“大小端存储”问题的详解的更多相关文章
- Java中堆内存和栈内存详解2
Java中堆内存和栈内存详解 Java把内存分成两种,一种叫做栈内存,一种叫做堆内存 在函数中定义的一些基本类型的变量和对象的引用变量都是在函数的栈内存中分配.当在一段代码块中定义一个变量时,ja ...
- Java中的equals和hashCode方法详解
Java中的equals和hashCode方法详解 转自 https://www.cnblogs.com/crazylqy/category/655181.html 参考:http://blog.c ...
- Linux中redis安装配置及使用详解
Linux中redis安装配置及使用详解 一. Redis基本知识 1.Redis 的数据类型 字符串 , 列表 (lists) , 集合 (sets) , 有序集合 (sorts sets) , 哈 ...
- 转:Java中的equals和hashCode方法详解
转自:Java中的equals和hashCode方法详解 Java中的equals方法和hashCode方法是Object中的,所以每个对象都是有这两个方法的,有时候我们需要实现特定需求,可能要重写这 ...
- Python中操作mysql的pymysql模块详解
Python中操作mysql的pymysql模块详解 前言 pymsql是Python中操作MySQL的模块,其使用方法和MySQLdb几乎相同.但目前pymysql支持python3.x而后者不支持 ...
- 教程-Delphi中Spcomm使用属性及用法详解
Delphi中Spcomm使用属性及用法详解 Delphi是一种具有 功能强大.简便易用和代码执行速度快等优点的可视化快速应用开发工具,它在构架企业信息系统方面发挥着越来越重要的作用,许多程序员愿意选 ...
- 在ASP.NET 5应用程序中的跨域请求功能详解
在ASP.NET 5应用程序中的跨域请求功能详解 浏览器安全阻止了一个网页中向另外一个域提交请求,这个限制叫做同域策咯(same-origin policy),这组织了一个恶意网站从另外一个网站读取敏 ...
- c++中内存拷贝函数(C++ memcpy)详解
原型:void*memcpy(void*dest, const void*src,unsigned int count); 功能:由src所指内存区域复制count个字节到dest所指内存区域. 说明 ...
- Android 中各种权限深入体验及详解
Android 中各种权限深入体验及详解 分类: Android2012-07-15 19:27 2822人阅读 评论(0) 收藏 举报 androidpermissionsinstallersyst ...
随机推荐
- 搭建完整邮件系统(postfix+dovecot+clamAV+Spamassassin+amavisd-new)
============================ 相关软件: 1. 发送邮件 --- postfix 2. 身份认证 --- sasl2 3. 接收邮件 --- dovecot 4. 防病毒邮 ...
- Android ExpandableListView BaseExpandableListAdapter (类似QQ分组列表)
分组列表视图(ExpandableListView) 和ListView不同的是它是一个两级的滚动列表视图,每一个组可以展开,显示一些子项,类似于QQ列表,这些项目来至于ExpandableListA ...
- 【剑指offer】链表倒数第k个节点
转载请注明出处:http://blog.csdn.net/ns_code/article/details/25662121 在Cracking the Code Interview上做过了一次,这次在 ...
- Linux/UNIX套接字连接
套接字连接 套接字是一种通信机子.凭借这样的机制.客户/server系统的开发工作既能够在本地单机上进行.也能够夸网络进行. 套接字的创建和使用与管道是有差别的.由于套接字明白地将客户和server区 ...
- PHP 将Base64图片保存到 Sae storage
<?php $file_dir='tu/'.date("Y/m/d").'/'; $fileName=create_guid(); $storage = new SaeSto ...
- MM32/STM32中断和事件梳理
Interrupt_event梳理 预备资料 MM32/stm32中文参考手册 Cortex-M3权威指南(深入了解中断和异常) MM32F103产品手册(配置GPIO的复用功能可能用到) 提出问题 ...
- JNI Java调用C代码 示例
Activity public class MainActivity extends ListActivity { static { System.loadLibrary(&q ...
- Java多线程——多线程的基本概念和使用
一.进程和线程的基础知识 1.进程和线程的概念 进程:运行中的应用程序称为进程,拥有系统资源(cpu.内存) 线程:进程中的一段代码,一个进程中可以有多段代码.本身不拥有资源(共享所在进程的资源) 在 ...
- N!水题
//题目是求N!的问题,思路:设定一个整形数组来存放每次计算过后的值 有两个for循环,第一个for循环每次加进一个数 然后在第二个for循环里面计算出此时的阶乘,比如9999,先给出i=2 在第二个 ...
- XML and JSON 验证
function ChkJson(strJson) { //判断Json格式是否正确 if (strJson == null || strJson == "") return tr ...