Intro
#- Inputs, Outputs, and Timers form the basis for almost everything embedded systems do.
- Registers:
- Registers are the API to the hardware.
- Are memory mapped, so you can write to a specific address to modify a register.
Binary and Hexadecimal Math
#- Controlling hardware is just flipping binary bits in memory.
- Hex comes in handy when we modify the whole variable. Because, each digit in hex
corresponds to a nibble(four bits) in binary.
- Left shifting is similar to multiplying by 2ShiftValue
Example:
1 << 3
= 0000 0001
« 3 = 0000 1000
= 8 = 23
- Right shifting is similar to dividing by 2ShiftValue
Example:
8 >> 3
= 0000 1000
» 3 = 0000 0001
= 1 = 8 / 23
- Last bit can tell us if a number is odd or even
Example:
5
= 0000 0101
(odd)4
= 0000 0100
(even)
References
#