Last reviewed 16 Sept 2026 · 9 min read
Analog and digital signals
- Analog — continuous values (e.g. temperature sensor voltage).
- Digital — discrete levels, typically binary (0 and 1) — noise immunity, easy storage and processing, reproducibility.
Number systems
| System | Base | Digits |
|---|---|---|
| Binary | 2 | 0, 1 |
| Octal | 8 | 0–7 |
| Decimal | 10 | 0–9 |
| Hexadecimal | 16 | 0–9, A–F (A = 10 … F = 15) |
Conversions
- Decimal → base b: repeated division by b for the integer part (remainders read bottom-up); repeated multiplication by b for fractions.
- Base b → decimal: sum of digit × b^position.
- Binary ↔ octal: group bits in threes; binary ↔ hexadecimal: group in fours (from the binary point).
Binary arithmetic and complements
- Binary addition: 0 + 0 = 0; 0 + 1 = 1; 1 + 1 = 10 (sum 0, carry 1); 1 + 1 + 1 = 11.
- 1's complement — invert all bits.
- 2's complement — 1's complement + 1; used to represent negative numbers and perform subtraction by addition.
- n-bit 2's complement range: to (8-bit: −128 to +127).
Codes
| Code | Description |
|---|---|
| BCD (8421) | Each decimal digit coded in 4 bits (0000–1001) |
| Excess-3 | BCD + 3 — self-complementing |
| Gray code | Successive values differ in only one bit — shaft encoders, reduces errors |
| ASCII | 7-bit alphanumeric code (e.g. 'A' = 65) |
| Parity bit | Error detection (even/odd parity) |
Binary to Gray: MSB same; each next Gray bit = XOR of adjacent binary bits.
Logic gates
| Gate | Expression | Output is 1 when |
|---|---|---|
| AND | All inputs are 1 | |
| OR | Any input is 1 | |
| NOT | Input is 0 | |
| NAND | Not all inputs are 1 | |
| NOR | All inputs are 0 | |
| XOR | Inputs differ (odd number of 1s) | |
| XNOR | Inputs are equal |
Universal gates: NAND and NOR — any logic function can be built using only NAND gates (or only NOR gates).
Boolean algebra
| Law | Expressions |
|---|---|
| Identity | ; |
| Null | ; |
| Idempotent | ; |
| Complement | ; |
| Involution | |
| Commutative, associative | As in ordinary algebra |
| Distributive | ; |
| Absorption | ; ; |
| De Morgan's theorems | ; |
| Consensus |
Canonical forms and K-maps
- Sum of products (SOP) — OR of AND terms (minterms, where output = 1).
- Product of sums (POS) — AND of OR terms (maxterms, where output = 0).
- Karnaugh map (K-map) — grid in Gray-code order; group adjacent 1s in powers of two (1, 2, 4, 8), as large as possible, including wrap-around; don't-care conditions (X) may be used to enlarge groups.