Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Pointer uint16_t

$
0
0

Hi all,
please could someone explain me next behavior on msp430 (code bellow). I expected tha value in var_unit should be 0x3412, but it is 0x1200.
I know all msp430 are little endian and therefore this byte order, but I am pointing to byte with value 0x12 and second byte should be 0x34.
Please help me with this elentar issue. Thank in advce for replay. David

#include "stdint.h" 
unsigned char buffer[6] = {0x00,0x12,0x34,0x56,0x78,0x90}; 
int main(void) { 
volatile unsigned int var_uint = *((unsigned int *)&buffer[1]); 
       //value in var_int is 0x1200 return 0; 
}


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>