1/38
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
How many wires does l2C communication require between devices?
Answer: 2 Wires (SDA [Serial Data] &SCL[Serial Clock] )
Which Memory is used to store variable that change during program execution?
The answer is RAM (SRAM)
A 10-bit ADC with Vref = 5V returns a raw value of 512. What is the input voltage?
Vin = 2.5V
What is the difference between Havard and Von Neumann Architectures?
Harvard architecture uses separate buses and memory for program instructions and data, allowing both to be accessed simultaneously
Von Neumann uses one shared bus for both, which can create a bottleneck.
AVR microcontrollers use Harvard architecture.
What happens when a microcontroller receives an interrupt request?
Why is a transistor typically used between a microcontroller I/O pin and a relay coil?
Because a microcontroller I/O pin cannot supply enough current to drive a relay coil directly.
A typical AVR I/O pin can supply only around 20-40mA max. A relay coil often requires 100-200mA or more.
A transistor acts as a current amplifier, a small current from the I/O pin controls the base, allowing a much larger current to flow through the collector to drive the relay coil.
In direct port manipulation on AVR, which register is written to in order to set output pin states?
PORTx - The output register
Writing a 1 to a bit sets that output pin HIGH
Writing 0 sets it LOW
DDRx controls direction I or O
PINx reads the current state of pins
What does writing a 1 to a bit in the DDRx (Data Direction Register) do?
Configures that pin as a digital output.
Writing 1 to a bit makes it an output
Writing 0 makes it an input
What is the function of the ALU in a microcontroller?
To perform arithmetic and logic operations
The ALU performs all mathematical and logical operations.
After each operation it updates the flags in the SREG
What is an Interrupt Service Routine (ISR)?
A special function that exectures automatically when an interrupt occurs
The CPU pauses its main program, executes the ISR, then returns to where it left off.
ISRs should be kept short and fast
A 10-bit ADC with Vref = 5V reads 3.5V. What is the approximate raw ADC value?
Answer: 716
ADC value = (Voltage / Vref) * 2^n
Always use 1024 in 2^n because and ADC is always a 10-bit.
How are negative integers typically stored in a microcontroller?
Using two's complement representation.
To negate a number: invert all bits (ones’ complement) then add 1.
For example, +5 = 00000101, so -5 = 11111010 + 1 = 11111011.
What is the role of the system clock in a microcontroller?
It synchronises all internal operations - every instruction executes in a set number of clock cycles/
The system clock is the heartbeat of the microcontroller.
All internal logic (fetch, decode, execute cycles, timers, peripherals) is synchronised to it. A faster clock means faster instruction execution.
In 4-bit mode LCD interfacing, how many data lines are used?
4 Data lines (DB4 - DB7)
Each byte is sent as two 4-bit nibbles. This saves 4 I/O pins on the microcontroller compared to 8-bit mode, at the cost of slightly slower communication.
What does 'duty cycle' mean in the context of PWM?
The frequency of the PWM signal in Hz
Answer: The percentage of time the signal is HIGH in one period.
A 50% duty cycle means the signal is HIGH for half the period. It controls average power delivered to a device.
What is the function of the MOSI (Master Out, Slave In) line in SPI (Serial Peripheral Interface)?
Answer: Master sends data to slave
This is the data line from the master to slave.
MISO(Master In, Slave Out) carries data from slave back to master.
What is the difference between the LDI (Load immediate) and LDS (Load direct from data space) instructions in AVR assembly?
Answer: LDI loads a constant directly into a register, LDS loads from a RAM adress.
In a state machine for a garage door controller, what would typically trigger a transition from 'Door Closed' to 'Door Opening'?
Answer: The open button being pressed by the user.
State machines define both the states a system can be in and the conditions that cause movement between states.
What is the key difference between a microcontroller and a microprocessor?
A microcontroller is a complete system on a single chip (CPU, RAM, Flash ROM, Timers, ADC, and I/O ports).
A microprocessor only contains the CPU and requires external components (RAM, ROM, I/O chips) to form a working system.
Why is an analogue multiplexer (mux) used in front of the ADC in a microcontroller?
Answer: To allow multiple analogue input pins to share a single ADC circuit
Most microcontrollers only have one ADC circuit but multiple analogue input pins.
The MUX acts as a switch that connects one analogue input at a time to the single ADC for conversion.
The software selects which channel to read by configuring the MUX control register.

What is the function of the Program Counter (PC)?
It holds the address of the next instruction to be fetched.
The PC holds the address of the next instruction to fetch from Flash memory. It increments after most instructions and is changed by jump, branch, and CALL/RET instructions.
What is the purpose of a Watchdog Timer?
Answer: To reset the microcontroller if the software becomes stuck or crashes
The Watchdog Timer is a safety Mechanism. The Software regularly “Kick“ the watchdog within a set time. If the program freezes and fails to reset it, the watchdog triggers an automatic system resets.
What is the main disadvantage of polling compared to interrupts?
Answer: Polling wastes CPU (Central Processing Unit) time constantly checking a pin
While Interrupts are hardware-driven, the CPU only stops its main task when the even actually occurs.
Which Arduino function is used to configure a pin as an input or output?
Answer: Pinmode()
What does analogRead() return on an Arduino with a 10-bit ADC?
Answer: An integer between 0 and 1023
How are multiple slave devices connected in an SPI system?
Answer: Each slave has its own SS (Slave Select) line from the master
In SPI (Serial Peripheral Interface), each device has its own dedicated SS (Slave Select) line connected to the master.
The master pulls a slave’s SS line LOW to select it for communication.
MOSI, MISO, and SCK (Serial Clock) are shared by all slaves.
Why is a pull-up resistor needed on a digital input connected to a switch?
Answer: To ensure the input has a defined logic level when the switch is open
Without a pull-up resistor, when a switch is open the input pin is “Floating“ and gives unpredictable readings. A pull-up connects the pin to Vcc ensuring logic HIGH when open, and logic LOW when the switch is pressed.
Where is the program code (firmware) stored in a microcontroller?
Answer: ROM (Read only Memory) (flash), because it is non-volatile
Program code is stored in ROM (Flash memory) because it is non-volatile. It retains contents when power is off.
RAM is volatile and loses its data on power-off, so it is only used for temporary variables.
What does SPI stand for?
What is the purpose of the Enable (E) pin on a parallel LCD display?
Answer: It latches data into the LCD when pulsed HIGH then LOW
The enable pin is used to strobe data into the LCD. The microcontroller puts data on the data bus, sets the RS pin, then pulses E high then low.
This latches the data into the LCD controller.
At 9600 baud with 1 start bit, 8 data bits, and 1 stop bit, how long does it take to transmit one byte?
Answer: 1.042ms
One frame = 10 bits (1 start + 8 data + 1 stop).
Time per bit = 1/(9600 baud) = 0.1042ms
Time for one byte = 10 × 0.1042 = 1.042ms
This is a common exam calculation, remember to count start and stop bits.
Why is Harvard architecture preferred in small microcontrollers?
Answer: It allows instructions and data to be fetched simultaneously
With separate program and data buses, the CPU can fetch the next instruction while executing the current one (Pipelining).
Since both memories are on the same chip, the dual-bus approach is practical and give significant speed advantages.
What does the Status Register (SREG) store?
Answer: Flags from the last ALU operation (Zero, Carry, Overflow)
The SREG holds flag bits set by the ALU: Zero (Z), Carry (C), Negative (N), Overflow (V), Half-carry (H), Sign (S), and the global interrupt Enable flag (I).
These allow conditional branching like BREQ and BRNE.
Which of the following is a typical use of PWM?
Answer: Controlling motor speed and LED brightness
PWM is used to control motor speed, LED brightness, and servo position.
The rapid switching between on and off means the average power is proportional to duty cycle.
What does baud rate mean in serial communication?
Answer: The number of signal changes (bits) per second
Baud rate is the nuimber of signal transitions (Symbols) per second.
At 9600 baud, 9600 bits are transmitted per second.
Each byte typically needs 10 bits (1 start + 8 data + 1 stop), so 9600 baud give approximately 960 per second.
Why is a flyback diode needed when connecting a relay or solenoid to a microcontroller output?
Answer: To protect the microcontroller from the voltage spike generated when the inductive load is switched off
When an inductive load (relay coil, solenoid) is switched off, the collapsing magnetic field generates a large voltage spike (back-EMF) that can damage the microcontroller.
A flyback diode (connected in reverse across the coil) clamps this spike providing a path for the current to dissipate safely.
What effect does changing a variable from 'unsigned char' to 'unsigned int' have on AVR assembly code?
Answer: Each variable now requires 2 bytes of RAM instead of 1, and more instructions are need to handle 16-bit values
An unsigned char is 1 byte(8 bit).
An unsigned int is 2 bytes(16 bit).
In AVR assembly this means each variable uses 2 RAM locations, and arithmetic requires extra instructions to handle the HIGH and LOW bytes separately, making the code longer and slower.
What makes EEPROM (Electrically Erasable Programmable Read-Only Memory) different from both RAM and Flash ROM?
Answer: EEPROM is non-volatile and can be written byte-by-byte during normal program execution
EEPROM is non-volatile (retains data without power) like flash.
But unlike flash, it can be written one byte at a time during program execution without needing to erase large blocks.
It is used for storing configuration data, calibration values or settings that need to survive power cycles.