Digital Electronics and Microcontrollers
Digital Electronics and Microcontrollers
This domain tests logic gates, Boolean algebra, flip-flops, counters, ADC/DAC, and microcontroller ports, timers, interrupts and serial links.
Core rules
- Know AND, OR, NOT, NAND, NOR, XOR truth tables and De Morgan's laws.
- A flip-flop stores one bit; counters and shift registers are built from flip-flops.
- CMOS inputs must not float; tie unused inputs to a defined level.
- An 8-bit ADC with a 5 V reference has one LSB = 5/256 = 19.5 mV; code = Vin × 256/Vref, rounded and limited to 255.
- In the 8051, ports are quasi-bidirectional, timers count machine cycles, and interrupts need flag clearing and vector awareness.
- A watchdog resets a hung program; debounce mechanical keys in hardware or software.
- UART needs matching baud rate, data bits, parity and stop bits, plus common ground.
Worked example
A sensor gives 1.25 V to an 8-bit ADC with Vref = 5 V. Code = 1.25 × 256/5 = 64. The quantisation step is 19.5 mV, so the reading represents 1.25 V ± half an LSB. If the code jumps between 63 and 64, that is normal noise near a step boundary. To improve resolution, use a lower reference, an external ADC or averaging, but do not exceed the ADC input range. Check whether the firmware treats the result as signed or unsigned.
Traps
Driving an active-low reset pin high; leaving CMOS inputs floating; forgetting key debounce; using an ADC reference that is not stable; integer overflow in timer calculations.