1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

M5NanoC6 (RISC-V) のバイトオーダーを調べる(格納される時のバイトの並び)

Last updated at Posted at 2025-01-28

参考

x 過去ログを見ょ!!!
x アルゴリズムは、あまり関係ないけど?
x 研究調査目的で非営利で引用しました。
x 「シリアルモニタ」は、なんどか開き直す
x 3.1.1
x unionは、共有体 (共用体)

いろいろ
今週中は、進捗が速すぎるのでジャブを何本か打つ予定!!!(何のこと)
したい事は、無線式のマイクロマウスの様な事をしたい。
事前調査のハマりポイントとは、コントローラーの感度調整かな?
そのまま、構造体を送っているのでチョット調査(なんのこと)
バイトオーダーは、基盤警察みたいな人が飛んでくるのかな?

目的
メモリー内でのバイトの並びを調べる

結果

o_coq785.jpg

プログラム



//ser_byte_order_M5NanoC6

void setup() {
  // put your setup code here, to run once:

  //シリアルの初期化
  Serial.begin(9600);
  Serial.println("");
  //シリアルの待ちが0.5*9
  for (int i = 0; i < 9; i++) {
    delay(500);  //接続待ち
    Serial.print(".");
  }  //for
  Serial.println("");

    union {
        uint32_t b4;
        uint16_t b2[2];
        uint8_t  b1[4];
    } bytes ;

    bytes.b4 = 0x12345678 ;
    Serial.printf ("bytes.b4: %08X\n", bytes.b4) ;
    Serial.printf ("bytes.b2: %04X, %04X\n", bytes.b2[0], bytes.b2[1]) ;
    Serial.printf ("bytes.b1: %02X, %02X, %02X, %02X\n", bytes.b1[0], bytes.b1[1], bytes.b1[2], bytes.b1[3]) ;

}

void loop() {
  // put your main code here, to run repeatedly:

}



1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?