1/31
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
What are 2 similarities between Microcontrollers and Microprocessors?
Both have a CPU and act as the brain of electronic devices
What are 2 differences between Microcontrollers and Microprocessors?
Microcontroller has CPU, RAM, ROM/Flash memory, timers and I/O ports on a single chip, while microprocessors only contain CPU.
Why are microcontrollers well-suited for embedded applications compared to microprocessors?
They already have memory, I/O, and peripherals internally so they require fewer external components which results in smaller size, lower cost, lower power consumption
Which architecture does the ATmega328P use ?
Harvard, because it's faster, predictable, reliable, and efficient
What is volatile Memory?
Memory that loses its data when power is removed, SRAM, DRAM, CPU registers and cache memory
What is Non-Volatile Memory
Memory that retains data even when power is turned off, Flash Memory, EEPROM, ROM, Hard drives, SSDs, SD cards
What is the purpose of the program counter?
To hold the memory address of the next instruction to be executed
What is the purpose of DDRx (Data Direction Register)
Controls whether each pin on port x is an input or output
What is the purpose of PORTx
It drives the Output HIGH or LOW, and is the Pull-up control for Input
What is the purpose of PINx
Used to read the value on each pin of port x
What is an Interrupt?
An interrupt is a signal that temporarily stops the normal execution of a program so the CPU can quickly respond to an important event.
What role does the interrupt flag play?
The interrupt flag is a bit (usually inside an interrupt-related register) that indicates an interrupt event has occurred and is waiting to be serviced.
Why must variables shared with ISRs be declared volatile
An ISR can change them behind the compiler's back, and volatile ensures the main program always sees the correct value
When would I choose an external interrupt instead of a pin change interrupt?
Use an external interrupt when you need precise, fast, edge-controlled triggering on a specific pin.
What are 3 timer modes supported by ATmega328P
Normal Mode, Clear Timer on Compare Match, and Fast PWM Mode
When would you use CTC mode instead of Fast PWM mode?
Use CTC mode when you want accurate timer-based interrupts or timing control.
What timer mode and ISR would you use if you wanted to make a system with a counter incrementing every 1ms.
CTC Mode
Why should ISRs be kept short
ISRs should be short to prevent blocking the main program, avoid missing interrupts, reduce latency, conserve stack space, and keep the system predictable.
In Fast Mode 3: What determines duty cycle and frequency of a PWM signal?
Frequency = CPU clock/(prescaler *(255+1)
Duty Cycle = (OCRnX+1)/(256)
In Fast Mode 7: What determines duty cycle and frequency of a PWM signal?
Frequency = CPU clock/(prescaler*(OCR0A + 1)
Duty Cycle = (OCRnX +1) / (OCR0A +1)
What are the steps of a single ADC conversion on ATmega328P
Set MUX bits, Set REFS0/REFS1, set ADPPS2:0 in ADCSRA, Set ADEN, set ADSC
What does the ADC prescaler control
The ADC prescaler divides the system clock (16 MHz on ATmega328P) down to create the ADC clock.
Why is it beneficial to trigger ADC using interrupts?
Avoids blocking, ensures consistent sampling, makes data handling cleaner.
How many lines does SPI use?
MOSI, Sends data from master to slave
MISO, Sends data from slave to master
SCK, Clock generated by master
SS, Selects which slave is active
Why does SPI tend to be faster than I2C?
SPI is faster than I²C because it uses full-duplex communication, avoids addressing/start-stop overhead, allows higher clock speeds, and has a simpler hardware protocol.
Baud Rate Definition
The number of signal changes (symbols) transmitted per second over a communication line. 1 baud = 1 bit per second
Why does mismatched baud rate cause errors?
Causes timing errors → bits misread → frame errors → corrupted data
What are start and stop bits
Start bit: Signals receiver to begin sampling.
Stop bit: Ensures receiver can detect the end of a byte and prepare for the next.
How many wires are required for UART?
2, TX (Transmit) and RX (Receive)
What is the purpose of bit-shifting when working with communication protocols
Bit-shifting is essential in communication protocols for:
1. Packing/unpacking multiple values into bytes
2. Extracting or masking specific bits
3. Serial bit-by-bit communication
4. Manipulating control or status registers
It allows precise control over data at the bit level, which is the foundation of all digital communication.
Name three factors influence microcontroller selection for a project?
Processing Power/Performance, Memory and Storage Requirements, Peripherals and I/O Needs
Examples where ATmega328P is Not a good choice
High Performance image processing or real-time video