繁体中文
高级搜索
 
首页 | 电子技术应用 | 行业最新动态 | 行业最新产品 | 软件资料下载 | 电路图纸欣赏 | 博客文章精选 | 电子精品论坛 | 电子技术贴吧

当前位置:首页 >> 博客文章精选 >> 单片机-----博客 >> 不同编译器处理位段的差异
不同编译器处理位段的差异
作者:   来源: 发表时间:2006-12-08  字号:  

CCS里面认位段是从高位开始的,而Keil和凌阳单片机的编译器UNSP IDE以及NIOS II IDE,C Builder里认位段是从低位开始的

同样做一个结构体,在Keil、UNSP IDE、NIOS II IDE、C Builder里要这样:

#define Uint unsigned int
typedef struct
{
Uint bit0 : 1;
Uint bit1 : 1;
Uint bit2 : 1;
Uint bit3 : 1;
Uint bit4 : 1;
Uint bit5 : 1;
Uint bit6 : 1;
Uint bit7 : 1;
Uint bit8 : 1;
Uint bit9 : 1;
Uint bit10 : 1;
Uint bit11 : 1;
Uint bit12 : 1;
Uint bit13 : 1;
Uint bit14 : 1;
Uint bit15 : 1;
}Bit;

而在CCS里就应该这样:

#define Uint unsigned int
typedef struct
{
Uint bit15 : 1;
Uint bit14 : 1;
Uint bit13 : 1;
Uint bit12 : 1;
Uint bit11 : 1;
Uint bit10 : 1;
Uint bit9 : 1;
Uint bit8 : 1;
Uint bit7 : 1;
Uint bit6 : 1;
Uint bit5 : 1;
Uint bit4 : 1;
Uint bit3 : 1;
Uint bit2 : 1;
Uint bit1 : 1;
Uint bit0 : 1;
}Bit;


!注意:如果您发现此文章出现影响您的阅读的状况,请从浏览器地址栏里复制本文的链接到留言本报告给站长解决!
  • 上一篇: avr128的开发
  • 下一篇: 为arm,51与优盘进行串口通信的东东

  • >> 联系我们请给我们留言·留言本
    本站所有提供的信息软件资料均来自网络,版权及著作权归原作者所有,如果无意中侵犯了您的相关权利或触及法律法规,请给我们留言, 我们将在24小时内删除。
      浙ICP备05071687号  电子技术精品网