Bit Banding Example
Bit Banding Example
Bit Banding Example
// Bitband alias --> 0x4200 0000 + 0x20*0xC000 + 0x20*0x08 + 0x1C = 0x4218 011C
//Solution 1 //Solution 2
// //
// Define a pointer to use to access memory // Define an alias to use to access memory
volatile uint8_t * T32_en_ptr; #define T32_en (*((volatile uint8_t *)(0x4218011C)))
T32_en_ptr = (volatile uint8_t *)(0x4218011C); // need to cast the integer
// set the initial value for the output
// set the initial value for the output T32_en = 0;
*T32_en_ptr = 0;
T32_en = 1;
*T32_en_ptr = 1;
T32_en = 0;
*T32_en_ptr = 0;
Cast the value as a pointer to an 8 bit int because the processor ignores
Common – last updated 6/18/18 all bits but bit0 on writes,
6 and returns 1 byte of either 0x00 or 0x01 on reads © tj
Bit Banding Example
Set the Timer32 enable bit using bit-banding
Debug – single step