Skip to main content
  1. Resources/
  2. Study Materials/
  3. Information & Communication Technology Engineering/
  4. ICT Semester 4/
  5. Embedded Systems (4343204)/

Embedded System (4343204) - Summer 2025 Solution

21 mins· ·
Study-Material Solutions Embedded-System 4343204 2025 Summer
Milav Dabgar
Author
Milav Dabgar
Experienced lecturer in the electrical and electronic manufacturing industry. Skilled in Embedded Systems, Image Processing, Data Science, MATLAB, Python, STM32. Strong education professional with a Master’s degree in Communication Systems Engineering from L.D. College of Engineering - Ahmedabad.
Table of Contents

Question 1(a) [3 marks]
#

Discuss characteristics of real time operating system.

Answer:

Table: RTOS Characteristics

CharacteristicDescription
DeterministicPredictable response times
Time ConstraintsHard and soft deadlines
Priority SchedulingTask execution by priority
Resource ManagementEfficient memory and CPU usage
  • Deterministic behavior: System responds within guaranteed time limits
  • Multitasking support: Multiple tasks execute concurrently with priority
  • Interrupt handling: Fast response to external events

Mnemonic: “RTOS Delivers Tasks Properly”


Question 1(b) [4 marks]
#

Describe AVR I/O port registers.

Answer:

Table: AVR I/O Port Registers

RegisterFunctionAccess
DDRxData Direction RegisterRead/Write
PORTxPort Output RegisterRead/Write
PINxPort Input RegisterRead Only
  • DDRx register: Controls pin direction (0=input, 1=output)
  • PORTx register: Sets output values or enables pull-up resistors
  • PINx register: Reads current pin states for input operations

Mnemonic: “Direction, Port, Pin - DPP”


Question 1(c) [7 marks]
#

Compare different AVR microcontrollers and What are the factors to be considered in selecting the microcontroller for embedded system?

Answer:

Table: AVR Microcontroller Comparison

FeatureATmega8ATmega32ATmega128
Flash Memory8KB32KB128KB
SRAM1KB2KB4KB
EEPROM512B1KB4KB
I/O Pins233253
Timers334

Selection Factors:

  • Processing speed: Clock frequency requirements for application
  • Memory requirements: Program and data storage needs
  • I/O requirements: Number of pins needed for interfacing
  • Power consumption: Battery life considerations for portable devices
  • Cost factor: Budget constraints and volume requirements
  • Development tools: Availability of compilers and debuggers

Mnemonic: “Speed, Memory, I/O, Power, Cost, Tools - SMIPCT”


Question 1(c OR) [7 marks]
#

Draw and explain general block diagram of embedded system.

Answer:

Diagram:

ISSKnewepniyustptocarhdDseesvicesMPiCMIoVBcPe/woarUmOeltoorttcrPaeoyoSgrnrueyttprspRolelygl.erOuADLtciEptsDuupstaltaDoyervsices

Components:

  • Input section: Sensors and switches provide data to system
  • Processing unit: Microcontroller executes program and controls operations
  • Output section: Displays results and controls external devices
  • Power supply: Provides regulated power to all components
  • Memory: Stores program code and data permanently
  • Communication: Interfaces with external systems via serial/wireless

Mnemonic: “Input, Process, Output, Power, Memory, Communication - IPOPMC”


Question 2(a) [3 marks]
#

Compare SRAM with EEPROM of ATMega32.

Answer:

Table: SRAM vs EEPROM Comparison

ParameterSRAMEEPROM
Size2KB1KB
VolatilityVolatileNon-volatile
Access SpeedFastSlow
Write CyclesUnlimited100,000 cycles
  • Data retention: SRAM loses data on power-off, EEPROM retains data
  • Usage purpose: SRAM for variables, EEPROM for configuration data

Mnemonic: “SRAM is Fast but Forgets, EEPROM Endures”


Question 2(b) [4 marks]
#

List Timer/counter 0 operation mode and explain anyone.

Answer:

Table: Timer0 Operation Modes

ModeNameDescription
0NormalCount up to 0xFF, overflow
1PWM Phase CorrectPWM with phase correction
2CTCClear Timer on Compare
3Fast PWMHigh frequency PWM

Normal Mode Explanation:

  • Counter operation: Counts from 0x00 to 0xFF continuously
  • Overflow flag: TOV0 flag set when counter overflows to 0x00
  • Interrupt generation: Can generate interrupt on overflow condition

Mnemonic: “Normal Counts, PWM Pulses, CTC Clears”


Question 2(c) [7 marks]
#

With a sketch, identify and write function of each pins of ATmega32.

Answer:

Diagram: ATmega32 Pin Configuration

(I(NO(TCX20C//(((((((KAAMM(((IIOOI/(II(OISRTNNCCCTTNNSSSCXXTT11P0101SIOKDD01BA1))))))))XX)))))))TTPPPPPPPPRVGAAPPPPPPPBBBBBBBBSCNLLDDDDDDD01234567TCD2101234561234567891111111111201234567890ATmega324333333333322222222209876543210987654321PPPPPPPPAGAPPPPPPPPPAAAAAAAARNVCCCCCCCCD01234567EDC765432107FC(((((((((((((((((AAAAAAAATTTTTTSSODDDDDDDDOODDMCDCCCCCCCCCCSSIOSKAL201234567CC)))))))))))))))21))

Pin Functions:

  • Port A: 8-bit ADC input pins (PA0-PA7)
  • Port B: SPI communication and timer functions
  • Port C: JTAG interface and I2C communication
  • Port D: UART communication and external interrupts
  • Power pins: VCC, GND, AVCC for analog supply
  • Crystal pins: XTAL1, XTAL2 for external oscillator

Mnemonic: “Analog-A, Bus-B, Communication-C, Data-D”


Question 2(a OR) [3 marks]
#

Explain data memory organization of ATmega32.

Answer:

Table: ATmega32 Memory Organization

Memory TypeAddress RangeSize
Registers0x00-0x1F32 bytes
I/O Registers0x20-0x5F64 bytes
Internal SRAM0x60-0x25F2048 bytes
  • General purpose registers: R0-R31 for arithmetic operations
  • I/O memory space: Control registers for peripherals
  • Internal SRAM: Variable storage during program execution

Mnemonic: “Registers, I/O, SRAM - RIS”


Question 2(b OR) [4 marks]
#

Draw TIFR and TCCR registers of timer/counter 0.

Answer:

Diagram: Timer0 Registers

TTICFF7CO7RRC00(|T6(W6iTGmiMem0r5e0r|5I/CnCOt4oMeu0rn14rt|u3eCprOtMOC03FC2o0lFn|a2tWg|rG2T1oMROl0eV1g2R|1i|0esTgtOieVs|0r0tC)|eSOr0C2F0|0)C|ST0O1V|1C|SO0C0F|1A|ICF1|OCF1B|

Bit Functions:

  • TOV0: Timer0 overflow flag bit
  • OCF0: Timer0 output compare match flag
  • CS02:CS00: Clock select bits for prescaler
  • WGM01:WGM00: Waveform generation mode bits

Mnemonic: “TIFR shows Flags, TCCR Controls Clock”


Question 2(c OR) [7 marks]
#

Draw and explain general block diagram of AVR microcontroller.

Answer:

Diagram: AVR Architecture

PIr/o(OgFArlLRaaUemsghiM)setmeoCrrPsyUCRoergFeiislteerDPTUAaeiADt(rmRCaSieTRprMAhseMem)roarlys

Components:

  • CPU core: Executes instructions and controls system operation
  • Program memory: Stores application code in non-volatile flash
  • Data memory: Temporary storage for variables and stack
  • ALU: Performs arithmetic and logical operations
  • Register file: 32 general-purpose working registers
  • I/O system: Interfaces with external hardware components
  • Peripherals: Built-in modules like timers, UART, ADC

Mnemonic: “CPU Controls Program, Data, I/O, Peripherals - CPDIP”


Question 3(a) [3 marks]
#

Write an AVR C program to toggle all the bits of Port B continuously with a 10 ms delay.

Answer:

#include <avr/io.h>
#include <util/delay.h>

int main()
{
    DDRB = 0xFF;        // Set Port B as output
    
    while(1)
    {
        PORTB = 0xFF;    // Set all bits high
        _delay_ms(10);   // 10ms delay
        PORTB = 0x00;    // Set all bits low  
        _delay_ms(10);   // 10ms delay
    }
}

Key Points:

  • DDRB = 0xFF: Configures all Port B pins as outputs
  • PORTB toggle: Alternates between 0xFF and 0x00

Mnemonic: “DDR Direction, PORT Output”


Question 3(b) [4 marks]
#

Explain function of MAX232.

Answer:

Table: MAX232 Functions

FunctionDescription
Level ConversionTTL to RS232 voltage levels
Charge PumpGenerates ±10V from +5V supply
Line DriversTwo transmit drivers
Line ReceiversTwo receive receivers
  • Voltage conversion: Converts 0-5V TTL to ±12V RS232 levels
  • Serial communication: Enables microcontroller to communicate with PC
  • Dual channel: Supports two-way communication simultaneously

Mnemonic: “MAX232 Makes Microcontroller Meet PC”


Question 3(c) [7 marks]
#

Write AVR C program to toggle all the bits of PORTC continuously with some delay. Use timer 0, mode 0 and no prescalar options to generate delay.

Answer:

#include <avr/io.h>

void timer0_delay()
{
    TCNT0 = 0;          // Initialize counter
    TCCR0 = 0x01;       // No prescaler, normal mode
    while(!(TIFR & (1<<TOV0))); // Wait for overflow
    TIFR |= (1<<TOV0);  // Clear overflow flag
    TCCR0 = 0;          // Stop timer
}

int main()
{
    DDRC = 0xFF;        // Port C as output
    
    while(1)
    {
        PORTC = 0xFF;    // All bits high
        for(int i=0; i<100; i++)
            timer0_delay(); // Multiple delays
            
        PORTC = 0x00;    // All bits low
        for(int i=0; i<100; i++)
            timer0_delay(); // Multiple delays
    }
}

Key Features:

  • Timer0 normal mode: Counts from 0 to 255 then overflows
  • No prescaler: Timer runs at system clock speed
  • Overflow detection: TOV0 flag indicates timer overflow
  • Delay generation: Multiple timer cycles create visible delay

Mnemonic: “Timer Counts, Overflow Flags, Generate Delays”


Question 3(a OR) [3 marks]
#

Write AVR C program to store #30h into location 0X011F of EEPROM.

Answer:

#include <avr/io.h>
#include <avr/eeprom.h>

int main()
{
    eeprom_write_byte((uint8_t*)0x011F, 0x30);
    return 0;
}

Alternative Method:

#include <avr/io.h>

int main()
{
    while(EECR & (1<<EEWE));    // Wait for previous write
    EEAR = 0x011F;              // Set address
    EEDR = 0x30;                // Set data
    EECR |= (1<<EEMWE);         // Master write enable
    EECR |= (1<<EEWE);          // Write enable
}

Mnemonic: “Address, Data, Master, Write - ADMW”


Question 3(b OR) [4 marks]
#

Discuss different data types for programming AVR in C.

Answer:

Table: AVR C Data Types

Data TypeSizeRange
char1 byte-128 to 127
unsigned char1 byte0 to 255
int2 bytes-32768 to 32767
unsigned int2 bytes0 to 65535
long4 bytes-2³¹ to 2³¹-1
float4 bytesIEEE 754 format
  • Memory efficiency: Choose smallest suitable data type
  • Unsigned types: Use when negative values not needed
  • Integer arithmetic: Faster than floating-point operations

Mnemonic: “Choose Correct Size for Memory Efficiency”


Question 3(c OR) [7 marks]
#

Write AVR C programs for serial data transmission.

Answer:

#include <avr/io.h>

void uart_init(unsigned int baud)
{
    UBRRH = (unsigned char)(baud>>8);
    UBRRL = (unsigned char)baud;
    UCSRB = (1<<TXEN);          // Enable transmitter
    UCSRC = (1<<URSEL)|(3<<UCSZ0); // 8-bit data
}

void uart_transmit(unsigned char data)
{
    while(!(UCSRA & (1<<UDRE))); // Wait for empty buffer
    UDR = data;                  // Send data
}

void uart_send_string(char *str)
{
    while(*str)
    {
        uart_transmit(*str++);
    }
}

int main()
{
    uart_init(51);              // 9600 baud at 8MHz
    
    while(1)
    {
        uart_send_string("Hello World\r\n");
        for(long i=0; i<100000; i++); // Delay
    }
}

Key Components:

  • Baud rate setting: UBRR registers set communication speed
  • Transmit enable: TXEN bit enables UART transmitter
  • Data transmission: UDR register holds data to transmit
  • Buffer check: UDRE flag indicates transmit buffer empty

Mnemonic: “Init, Enable, Check, Transmit - IECT”


Question 4(a) [3 marks]
#

Explain ADMUX register.

Answer:

Table: ADMUX Register Bits

BitNameFunction
REFS1:0Reference SelectVoltage reference selection
ADLARLeft AdjustResult left adjustment
MUX4:0Channel SelectADC input channel selection
  • Reference voltage: Selects internal/external voltage reference
  • Result format: ADLAR bit adjusts 10-bit result alignment
  • Channel selection: MUX bits choose which ADC pin to read

Mnemonic: “Reference, Adjust, Channel - RAC”


Question 4(b) [4 marks]
#

Draw and explain Interfacing Relay with ATmega32.

Answer:

Diagram: Relay Interfacing

ATRTmP==eAg0B1aCK3524R7esRTirsatnosrisGtNNoTPDrN[Rel+aR1ye2lVCaoyilC]ircuit

Components:

  • Transistor switch: BC547 NPN transistor acts as electronic switch
  • Base resistor: 1KΩ limits base current from microcontroller
  • Relay coil: 12V relay operates external high-power devices
  • Protection diode: Freewheeling diode protects from back EMF

Mnemonic: “Micro Controls Transistor Controls Relay”


Question 4(c) [7 marks]
#

Draw and explain TWI registers in AVR.

Answer:

Diagram: TWI Register Structure

TTTWT7WT7WT7CWSWDWRIRSRDN77(T((TTTTTWTWW6WW6IW6ISIDE66CASDotTaTnTaWtWtWtS5aD5rS5u55oTsRlATeTRWgWRTeS4iD4eWg4s4gS4itiTsTeTsOtWrWteS3)D3eTr33rW3))WTC2WD2T2WTE2WTNP1WSD1111TTWWTP0D0WS0I00E

Register Functions:

  • TWCR: Controls TWI operation and interrupt handling
  • TWSR: Provides status information and prescaler setting
  • TWDR: Holds data for transmission/reception
  • TWAR: Sets slave address when operating as slave
  • TWBR: Sets bit rate for TWI communication
  • TWINT: Interrupt flag cleared by writing 1
  • Start/Stop: TWSTA and TWSTO control I2C conditions

Mnemonic: “Control, Status, Data, Address, Bit Rate - CSDAB”


Question 4(a OR) [3 marks]
#

Explain ADCSRA register.

Answer:

Table: ADCSRA Register Bits

BitNameFunction
ADENADC EnableEnables ADC module
ADSCStart ConversionStarts ADC conversion
ADATEAuto TriggerEnables auto trigger mode
ADIFInterrupt FlagADC conversion complete flag
ADIEInterrupt EnableEnables ADC interrupt
ADPS2:0PrescalerSets ADC clock prescaler
  • ADC control: ADEN enables ADC, ADSC starts conversion
  • Interrupt system: ADIF flag set when conversion complete

Mnemonic: “Enable, Start, Trigger, Interrupt, Prescale - ESTIP”


Question 4(b OR) [4 marks]
#

Draw and explain interfacing of LM35 with ATmega32.

Answer:

Diagram: LM35 Interfacing

+GVTOL5NoeuMVDumt3tpp5eurt[a:LtMu13r05em]VS/e°nCsorATPmAe0ga(3A2DC0)

Connection Details:

  • Power supply: LM35 requires +5V and ground connections
  • Output voltage: Produces 10mV per degree Celsius
  • ADC input: Connect LM35 output to ADC channel (PA0)
  • Temperature calculation: °C = (ADC_Value × 5000mV) / (1024 × 10mV)

Code Example:

float temp = (adc_read() * 5.0 * 100.0) / 1024.0;

Mnemonic: “LM35 gives 10mV per degree”


Question 4(c OR) [7 marks]
#

Draw and explain interfacing of multiple 7-segment displays using MAX7221 with ATmega32.

Answer:

Diagram: MAX7221 Interfacing

APPPTBBBm574e(((gMSSaOCS3SK)2I))+G5NVDMDCCVGSSSSSSSSAILSCNEEEEEEEEXNKCDGGGGGGGG7ABCDEFGD2P21tCoomamlolndsiesgpml7ea-DDDDDDDnySIIIIIIItseGGGGGGGsg0123456mentDiDDDDDDDsiiiiiiipssssssslpppppppalllllllyaaaaaaasyyyyyyy1234567

Features:

  • SPI communication: Uses serial peripheral interface for control
  • Multiple displays: Controls up to 8 seven-segment displays
  • Automatic scanning: MAX7221 handles multiplexing automatically
  • Brightness control: Software-controlled brightness levels
  • Decode mode: Built-in BCD to 7-segment decoder
  • Low component count: Reduces external components needed

Key Registers:

  • Decode mode register: Enables/disables BCD decoding
  • Intensity register: Controls display brightness
  • Scan limit register: Sets number of active displays
  • Shutdown register: Normal operation or shutdown mode

Mnemonic: “SPI Sends Serial Data to Multiple Displays”


Question 5(a) [3 marks]
#

Explain SPCR register.

Answer:

Table: SPCR Register Bits

BitNameFunction
SPIEInterrupt EnableEnables SPI interrupt
SPESPI EnableEnables SPI module
DORDData OrderLSB/MSB first selection
MSTRMaster/SlaveSelects master or slave mode
CPOLClock PolarityClock idle state selection
CPHAClock PhaseClock edge for data sampling
SPR1:0Clock RateSPI clock rate selection
  • SPI enable: SPE bit must be set to enable SPI functionality
  • Master mode: MSTR bit determines if device is master or slave

Mnemonic: “Interrupt, Enable, Data, Master, Clock settings - IEDMC”


Question 5(b) [4 marks]
#

Draw circuit diagram to interface DC motor with ATmega32 using L293D motor driver.

Answer:

Diagram: DC Motor Interfacing

APP+GPTAA5NAm01VD2ega32IIIIVGEnN0011NNCNNp112CD1u1tILN0101Lo22OOVGg9UUCNi3TTCDcMSCCBD122otCWrTtoWaaopkbrele:G1N2DVD[CMoMMtootro]r

Components:

  • L293D driver: Provides current amplification for motor control
  • Power supplies: +5V for logic, +12V for motor power
  • Control signals: IN1, IN2 determine motor direction
  • Enable pin: EN1 controls motor on/off and speed (PWM)

Mnemonic: “Logic controls Direction, Enable controls Speed”


Question 5(c) [7 marks]
#

Explain IoT based Home Automation System.

Answer:

Diagram: IoT Home Automation System

InStWmeRiaroEFArnuSiptetPppte3Mhr2CoCUnleoudAMTaSmieTMLenneoDgsmtRaMopi3Cro2UsnDeLFASviaCeigncchuetrssity

System Components:

  • Internet connectivity: WiFi module connects system to internet
  • Mobile application: User interface for remote control and monitoring
  • Sensor network: Temperature, motion, light sensors for automation
  • Control devices: Relays control home appliances and lights
  • Central controller: Microcontroller processes commands and sensor data
  • Cloud services: Store data and enable remote access

Features:

  • Remote control: Control appliances from anywhere via internet
  • Automation: Automatic control based on sensor readings
  • Energy saving: Smart scheduling reduces power consumption
  • Security monitoring: Motion sensors and cameras for safety
  • Data logging: Historical data storage for analysis

Mnemonic: “Internet connects Phones to Home Devices - IPHD”


Question 5(a OR) [3 marks]
#

Explain SPSR register.

Answer:

Table: SPSR Register Bits

BitNameFunction
SPIFInterrupt FlagSPI transfer complete flag
WCOLWrite CollisionData collision error flag
SPI2XDouble SpeedDoubles SPI clock rate
  • Transfer complete: SPIF flag indicates SPI transmission finished
  • Collision detection: WCOL flag shows write collision occurred
  • Speed control: SPI2X doubles communication speed when set

Mnemonic: “Flag, Collision, Speed - FCS”


Question 5(b OR) [4 marks]
#

Draw and explain pin diagram of L293D motor driver IC.

Answer:

Diagram: L293D Pin Configuration

EIOGGOIVNNUNNUNC11TDDT2C12212345678L293D(16-pinDIP)111111165432109VIOGGOIECNUNNUNNC4TDDT32143

Pin Functions:

  • Enable pins (EN1, EN2): Control motor on/off and speed via PWM
  • Input pins (IN1-IN4): Logic inputs from microcontroller
  • Output pins (OUT1-OUT4): High current outputs to motors
  • Power supply (VCC1): +5V logic supply for IC operation
  • Motor supply (VCC2): +12V supply for motor power
  • Ground pins: Multiple ground connections for heat dissipation

Features:

  • Dual H-bridge: Can control two DC motors simultaneously
  • Current capacity: 600mA per channel, 1.2A peak
  • Protection: Built-in flyback diodes for motor protection

Mnemonic: “Enable, Input, Output, Power - EIOP”


Question 5(c OR) [7 marks]
#

Explain Motorised Control Robotics System.

Answer:

Diagram: Robotics Control System

CSUIGCoBWRelRyamliFntrmmuFsrSoeueiMoaesrntorsncaiodsosocounopatlirethecionMicAPDCPBRPrTreooaeromocnwtgocecitetutogesrrelenasioract3solSyttr2inuoionprolgpsnlleyrADSSGFEPScCetrenoptreiecseuMvppdoieaooppbdtdtteeaeiooMrrcrorroksnsstors

System Components:

Table: Robotics System Elements

ComponentFunctionExamples
SensorsEnvironment sensingUltrasonic, IR, Camera
ControllerDecision makingATmega32, Arduino
ActuatorsPhysical movementMotors, Servos
CommunicationRemote controlBluetooth, WiFi
PowerEnergy supplyBattery, Regulators
FeedbackPosition sensingEncoders, Gyroscope

Control Algorithm:

  • Sense: Collect data from environment using sensors
  • Process: Analyze sensor data and make decisions
  • Act: Control motors and actuators based on decisions
  • Feedback: Monitor actual movement and adjust control
  • Communicate: Send status and receive commands remotely

Applications:

  • Autonomous navigation: Robot moves independently using sensors
  • Object manipulation: Gripper controlled for pick and place tasks
  • Remote operation: Manual control via wireless communication
  • Path following: Line following or predetermined route navigation
  • Obstacle avoidance: Dynamic path planning around obstacles

Programming Structure:

while(1) {
    read_sensors();
    process_data();
    make_decision();
    control_motors();
    check_feedback();
    communicate_status();
}

Mnemonic: “Sense, Process, Act, Feedback, Communicate - SPACF”

Related

Embedded System (4343204) - Summer 2024 Solution
16 mins
Study-Material Solutions Embedded-System 4343204 2024 Summer
Programming in C (4331105) - Summer 2025 Solution
Study-Material Solutions Programming-C 4331105 2025 Summer
Mobile & Wireless Communication (4351104) - Summer 2025 Solution
Study-Material Solutions Mobile-Communication 4351104 2025 Summer
VLSI Technology (4353206) - Summer 2025 Solution
21 mins
Study-Material Solutions Vlsi-Technology 4353206 2025 Summer
Computer Networking (4343202) - Summer 2025 Solution
14 mins
Study-Material Solutions Networking 4343202 2025 Summer
Database Management System (1333204) - Summer 2025 Solution
17 mins
Study-Material Solutions Database 1333204 2025 Summer