ビットフィールドと共用体と

スーパーpre記法つかうとセンタリングされる…なんでやねん。

typedef struct {
  unsigned s1:1;  /* センサ1 */
  unsigned s2:1;  /* センサ2 */
  unsigned s3:1;  /* センサ3 */
  unsigned s4:1;  /* センサ4 */
  unsigned s5:1;  /* センサ5 */
  unsigned rsv:3  /* 予約(未使用) */
} SixthByteSt_t;  /* 6番目のバイトデータ構造体 */

typedef union {
  SixthByteSt_t bitdat;
  unsigned char bytedat;
} SampleUnion_t;  /* お試し共用体 */

-----
SampleUnion_t smpldat;

smpldat.bytedat = 入力値(byte);  /* byte単位でデータセット */
if( 0 != smpldat.bitdat.s1 ) {  /* bit取り出し */
  /* センサ1がOn */
}