![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
いろいろなテクニック.Nucleo と DISCO-F746 用.
Dependencies: Array_Matrix mbed
UnionExample.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2019-04-10
- Revision:
- 1:bbb9f0c3e523
- Parent:
- 0:bb939e0bc6e2
File content as of revision 1:bbb9f0c3e523:
//-------------------------------------------------------------- // "union" のテスト //-------------------------------------------------------------- #include "mbed.h" void UnionExample() { union Int16U8 { int16_t v16; uint8_t uv8[2]; }; Int16U8 x1, x2; x1.uv8[0] = 1; // 下位バイト x1.uv8[1] = 2; // 上位バイト printf("\r\nx1.v16 = 0x%04X", x1.v16); printf("\r\nx1.uv8[0] = 0x%02X, x1.uv8[1] = 0x%02X\r\n", x1.uv8[0], x1.uv8[1]); x2.uv8[0] = 255; x2.uv8[1] = 255; printf("\r\nx2.v16 = %d\r\n", x2.v16); }