
MICROCONTROLLER DIGI NOTES by ELECTRICAL ZINDAGI
Table of Contents
Microcontroller Essentials — Quick, exam-focused one-liners
Microcontroller = CPU + Memory + I/O on single chip — remember: "C-MIO" (Compact Microcontroller In One).
Harvard vs Von-Neumann: Harvard has separate code/data buses — faster for DMA and peripherals.
RISC vs CISC: RISC uses fewer cycles per instruction — think "Reduced steps, faster loop" for time-critical tasks.
GPIO direction: Configure DDRx as 1 for output, 0 for input — trick: DDR = Data Direction Register.
Debounce switches: use 10–20 ms software delay or RC filter — exam trick: "Cap + resistor = clean click".
Analog readings require ADC; choose reference carefully — internal Vref gives stability, external for accuracy.
PWM duty cycle controls average voltage — use low-pass filter to convert PWM to analog voltage for motors.
I2C basics: two wires (SDA, SCL), address 7-bit or 10-bit — remember: "Pull-ups are mandatory".
SPI uses MOSI, MISO, SCK, SS — full-duplex high-speed; pick SPI for display and flash memory interfaces.
UART framing: start bit, data bits, optional parity, stop bits — common format 8-N-1 (8 data, no parity, 1 stop).
Interrupts save CPU cycles — use ISRs for external events; keep ISRs short to avoid priority inversion.
Watchdog timer resets MCU if stuck — enable in safety-critical designs; test by intentionally triggering reset during lab checks.
Timers count clock ticks — Timer prescalers trade off range vs resolution. Trick: prescale to fit expected time window.
Bootloader allows firmware update over serial — useful during field updates; keep bootloader small and protected.
Brown-out detection prevents unpredictable operation during low supply voltage — enable to protect flash writes.
EEPROM vs Flash: EEPROM supports byte writes; flash often needs page erase — exam often asks difference in erase/write granularity.
GPIO pull-ups: use internal pull-up for buttons to ground; external if you need stronger current or precise levels.
Use DMA for large, repeated data transfers (like ADC streaming) — frees CPU and reduces jitter for real-time tasks.
Power modes: sleep, standby, deep-sleep — choose lowest power that still allows required wake sources to save battery life.
Clock sources: crystal = accurate, internal RC = cheaper but drifts. For serial comms use crystal or calibrated internal clock.
Pin multiplexing: peripherals share pins — check datasheet and remap carefully to avoid conflicts.
Level shifting: use MOSFET-based or resistor divider + buffer when interfacing 5V peripherals to 3.3V MCU pins.
Serial boot vs OTA: Over-the-air needs secure update process; exams ask about integrity (use checksums/CRC).
ADC sampling rate: input source impedance matters — add small capacitor at ADC pin to reduce sampling error for high-res ADCs.
GPIO current limits: never exceed per-pin and total port currents; use external driver for motors and relays.
Debouncing trick: sample input every 5ms for 3 consecutive reads before accepting state change — simple and effective.
Use CRC16 for blocks of firmware to validate correctness after transfer — exam often asks about simple integrity checks.
Assembler vs C: learn basic assembly for understanding compiler output and timing-critical loops — exam q's often from both.
Interrupt priority: nested vectored interrupt controller (NVIC) orders ISR priority — mark critical ones higher and keep low-priority deferred.
Encoder reading: quadrature encoders need both-channel sampling or hardware quadrature decoder to avoid missed counts at high speed.
Sensor calibration: store calibration constants in EEPROM and apply on startup; saves repeated field calibration during maintenance.
Power sequencing: some peripherals require Vcc ordering; check datasheet and add soft-start if necessary to avoid latch-up.
UART baud error: small clock error accumulates; calculate max allowable baud error (%) to keep communication stable — exam fav topic.
Use software state machine for protocol handling — easier to test than spaghetti if-else statements; diagram states on paper first.
Always place 0.1uF decoupling near MCU Vcc pins — exam loves this basic hardware practice for stable operation.
May You Like These Posts
Relevant posts from Electrical Zindagi — quick links for further reading and backlinks.
Title | Quick Link |
---|---|
Basic MCQs in Electrical Engineering | Visit post |
Ohm's Law & Circuit Tricks | Visit post |
New Model MCQ in Detail — Electrical | Visit post |
Digital Electronics Short Notes | Visit post |
Tip: Replace the 'Visit post' URLs with exact post URLs from your blog for targeted backlinks.
Join Us for Regular Updates
Follow our channels and never miss notes, videos and downloads.
Donate & Support the Community
Contribute to keep the notes free and maintained. Your support helps create more digital resources for AE / JE aspirants.
Sponsored / Ads
Ads help keep these notes free — consider supporting the blog or disabling adblock for Electrical Zindagi to help the community grow.