请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:MSP430FR2476 您好!
是 msp430fr2476小端字节序吗?
我使用过早期的 MSP430g 系列、它是小端字节序。 我可以找到的所有文档都显示 MSP430是小端字节序。
我在 MSP430FR2476中运行以下代码并附上结果。
#include <msp430.h> #include <stdint.h> #include <stdlib.h> #include <string.h> /** * main.c */ int main(void) { WDTCTL = WDTPW | WDTHOLD; // stop watchdog timer volatile uint8_t arr[5] = {0x88, 0x77, 0x66, 0x55}; volatile uint16_t byte_2,byte_1; byte_2 = (uint16_t)( *((uint16_t *)&arr[1]) ); if(byte_2) byte_1=0; while (1) ; return 0; }
如果 MSP430FR2476是小端字节序。 在上图中、变量"byte_2"应为0x6677、但显示为0x7788。
我缺少什么吗?