voidShowBytes(void*start,uint8_t len){
uint8_t i;for( i =0; i < len; i++){
printf("|%.2x",((uint8_t*)start)[i]);// can't be "char *", [-128, 127], if( i %8==7){
// 8 in a rowprintf("|\r\n");// end of a row};}if( len %8!=0){
printf("|\r\n");}}
“乱七八糟” 版本
voidshow_bytes(void*start,uint8_t len, BOOL isAtomics){
uint8_t i;for(i =0; i < len; i++){
if(isAtomics &&(Little_Endian ==check_memory_mode())){
printf("|%.2x",((uint8_t*)start)[len - i -1]);}else{
printf("|%.2x",((uint8_t*)start)[i]);}};printf("|\r\n");}
2.2 原子(Atomics)类型
2.2.1 无符号数
8位无符号数 unsigned char
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
2 7 2^7 27
2 6 2^6 26
2 5 2^5 25
2 4 2^4 24
2 3 2^3 23
2 2 2^2 22
2 1 2^1 21
2 0 2^0 20
16位无符号数 unsigned short
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
2 15 2^{15} 215
2 14 2^{14} 214
2 13 2^{13} 213
2 12 2^{12} 212
2 11 2^{11} 211
2 10 2^{10} 210
2 9 2^9 29
2 8 2^8 28
0/1
0/1
0/1
0/1
0/1
0/1
0/1
0/1
2 7 2^7 27
2 6 2^6 26
2 5 2^5 25
2 4 2^4 24
2 3 2^3 23
2 2 2^2 22
2 1 2^1 21
2 0 2^0 20
32位无符号数 unsigned int / unsigned long (x86-64) 注意:在linux64中,unsigned long 占用 64 bits 注意:在 MCS-51 & Keil 中,unsigned int 占用 16 bits