PIC24 Support Libraries
Data Fields
UINT16 Union Reference

#include <all_generic.h>

Data Fields

uint16_t _uint16
 
uint16_t u16
 
int16_t int16
 
int16_t i16
 
uint8_t u8Lsb
 
uint8_t u8Msb
 
uint8_t u8Bytes [2]
 
unsigned b0: 1
 
unsigned b1: 1
 
unsigned b2: 1
 
unsigned b3: 1
 
unsigned b4: 1
 
unsigned b5: 1
 
unsigned b6: 1
 
unsigned b7: 1
 
unsigned b8: 1
 
unsigned b9: 1
 
unsigned b10: 1
 
unsigned b11: 1
 
unsigned b12: 1
 
unsigned b13: 1
 
unsigned b14: 1
 
unsigned b15: 1
 

Detailed Description

Union structure to hold uint16s to provide access to 16-bit data with different "viewpoints" (or casts, if you will).

Note
Works on machines that store their data little-endian. If you use big-endian, the members will have to be reordered!
Prefix for all UINT16 structs is U16_
uint8_t u8_a, u8_b;
UINT16 U16_y;
U16_y._uint16 = 0xF00D;
u8_b = U16_y.u8Bytes[0]; // u8_b equals 0x0D
u8_a = U16_y.u8MSb; // u8_a equals 0xF0
while (U16_y.b7); // falls through since bit 7 is 0 (FALSE)

Definition at line 112 of file all_generic.h.

Field Documentation

◆ _uint16

uint16_t UINT16::_uint16

uint16 viewed as an uint16

Definition at line 114 of file all_generic.h.

◆ b0

unsigned UINT16::b0

bit 0 (the LSb) of the uint16

Definition at line 140 of file all_generic.h.

◆ b1

unsigned UINT16::b1

bit 1 of the uint16

Definition at line 143 of file all_generic.h.

◆ b10

unsigned UINT16::b10

bit 10 of the uint16

Definition at line 170 of file all_generic.h.

◆ b11

unsigned UINT16::b11

bit 11 of the uint16

Definition at line 173 of file all_generic.h.

◆ b12

unsigned UINT16::b12

bit 12 of the uint16

Definition at line 176 of file all_generic.h.

◆ b13

unsigned UINT16::b13

bit 13 of the uint16

Definition at line 179 of file all_generic.h.

◆ b14

unsigned UINT16::b14

bit 14 of the uint16

Definition at line 182 of file all_generic.h.

◆ b15

unsigned UINT16::b15

bit 15 (the MSb) of the uint16

Definition at line 185 of file all_generic.h.

◆ b2

unsigned UINT16::b2

bit 2 of the uint16

Definition at line 146 of file all_generic.h.

◆ b3

unsigned UINT16::b3

bit 3 of the uint16

Definition at line 149 of file all_generic.h.

◆ b4

unsigned UINT16::b4

bit 4 of the uint16

Definition at line 152 of file all_generic.h.

◆ b5

unsigned UINT16::b5

bit 5 of the uint16

Definition at line 155 of file all_generic.h.

◆ b6

unsigned UINT16::b6

bit 6 of the uint16

Definition at line 158 of file all_generic.h.

◆ b7

unsigned UINT16::b7

bit 7 of the uint16

Definition at line 161 of file all_generic.h.

◆ b8

unsigned UINT16::b8

bit 8 of the uint16

Definition at line 164 of file all_generic.h.

◆ b9

unsigned UINT16::b9

bit 9 of the uint16

Definition at line 167 of file all_generic.h.

◆ i16

int16_t UINT16::i16

int16 viewed as an int16

Definition at line 120 of file all_generic.h.

◆ int16

int16_t UINT16::int16

int16 viewed as an int16

Definition at line 118 of file all_generic.h.

◆ u16

uint16_t UINT16::u16

uint16 viewed as an uint16

Definition at line 116 of file all_generic.h.

◆ u8Bytes

uint8_t UINT16::u8Bytes[2]

The uint16 viewed as an array of two (2) uint8s

Definition at line 135 of file all_generic.h.

◆ u8Lsb

uint8_t UINT16::u8Lsb

LSB (uint8) of the uint16

Definition at line 123 of file all_generic.h.

◆ u8Msb

uint8_t UINT16::u8Msb

MSB (uint8) of the uint16

Definition at line 125 of file all_generic.h.


The documentation for this union was generated from the following file: