BE Computer Engineering (IOE, TU) Embedded System (IOE, CT 655) Question Paper 2078 Nepal
This is the official BE Computer Engineering (IOE, TU) Embedded System (IOE, CT 655) question paper for 2078, as set in the regular annual examination. It carries 80 full marks and a time allowance of 180 minutes, across 13 questions. On Kekkei you can attempt this Embedded System (IOE, CT 655) past paper online with a timer, get instant AI feedback and step-by-step solutions, and track the topics where you lose marks — completely free. Whether you are revising for your BE Computer Engineering (IOE, TU) Embedded System (IOE, CT 655) exam or solving previous years' question papers, this 2078 paper is a great way to practise under real exam conditions.
Section A: Long Answer Questions
Attempt all / any as specified.
(a) Define an embedded system and explain its key characteristics that distinguish it from a general-purpose computing system. [6]
(b) With a neat block diagram, describe the typical hardware architecture of an embedded system, clearly identifying the role of the processor core, memory subsystem (RAM, ROM/Flash), input/output ports, and peripheral interfaces. [6]
(a) Definition and Key Characteristics [6]
Definition: An embedded system is a dedicated computer system designed to perform one or a few specific functions, in which hardware and software are tightly integrated, and which is usually embedded as a part (subsystem) of a larger mechanical or electrical system. Examples: washing-machine controller, automotive ABS, digital camera firmware.
Distinguishing characteristics (vs. a general-purpose computer):
- Application-specific / dedicated: runs a fixed task, not arbitrary user programs.
- Real-time operation: must respond to events within strict time deadlines.
- Resource-constrained: limited CPU speed, memory (RAM/Flash), and power.
- Low power consumption: often battery operated; power efficiency is critical.
- Reliability and robustness: expected to run unattended for long periods, often in harsh environments.
- Tightly coupled hardware + software (firmware): software stored in ROM/Flash, no hard disk or general OS in many cases.
- Reactive and deterministic: continuously interacts with the physical world via sensors/actuators.
- Cost and size sensitive: mass-produced, so cost, weight and form factor matter.
(b) Hardware Architecture [6]
Block diagram (described): A central Processor Core sits in the middle. To its left, a Memory Subsystem (RAM + ROM/Flash) connects via the address/data/control bus. Below it, I/O ports and Peripheral Interfaces (timers, ADC/DAC, UART, SPI, I2C) connect to external sensors (inputs) and actuators/displays (outputs). A clock/oscillator and power supply feed the whole system.
Sensors Actuators/Display
| ^
v |
[ Input Ports ] [ Output Ports ]
| ^
+----------------+ +------------------+
| |
[ RAM ] --- bus --- [ Processor Core / CPU ] --- bus --- [ ROM/Flash ]
|
[ Peripherals: Timers, ADC/DAC, UART/SPI/I2C ]
[ Clock/Oscillator ] [ Power Supply ]
Roles:
- Processor core (CPU): executes the firmware, performs arithmetic/logic and control; the heart of the system (microcontroller/microprocessor/DSP).
- Memory subsystem:
- RAM — volatile working memory for variables, stack and runtime data.
- ROM/Flash — non-volatile storage holding the program code (firmware) and constants; retained on power-off.
- I/O ports: digital input/output pins through which the CPU reads switches/sensors and drives LEDs/relays/actuators.
- Peripheral interfaces: on-chip units such as timers/counters, ADC/DAC, and serial buses (UART, SPI, I2C) that let the CPU communicate with the analog world and other devices.
Explain the embedded system design process. Your answer should:
(a) Describe the major phases from requirement specification through to maintenance, illustrating the flow with a suitable design life-cycle diagram. [7]
(b) Discuss the key trade-offs a designer must consider among performance, power consumption, cost, and time-to-market while selecting hardware and software for an embedded product. [5]
(a) Embedded System Design Life-Cycle [7]
The design proceeds through the following major phases:
- Requirement Specification: capture functional requirements (what the system must do) and non-functional requirements (performance, power, cost, size, reliability).
- System Specification / Modelling: translate requirements into a precise specification (block diagrams, state machines, data flow).
- Architecture / Hardware-Software Partitioning: decide which functions are done in hardware and which in software; choose processor, memory and peripherals.
- Detailed Design: design the hardware (schematic, PCB) and software (modules, RTOS tasks, drivers) in parallel.
- Implementation: build/fabricate the hardware and write the firmware.
- Integration & Testing: combine HW and SW, debug, and verify against the specification (unit, integration, system testing).
- Deployment / Manufacturing: release the product for production.
- Maintenance & Upgrades: field support, bug fixes, firmware updates.
Life-cycle flow (described): Requirement Spec → System Spec → HW/SW Partitioning → (Hardware Design ∥ Software Design) → Integration → Testing → Deployment → Maintenance, with feedback arrows looping back to earlier phases whenever a verification step fails.
Requirements -> Specification -> Partitioning -> [HW design | SW design]
^ |
| v
Maintenance <- Deployment <- Testing <- Integration
(b) Key Design Trade-offs [5]
- Performance vs. Power: higher clock speeds and more powerful cores improve throughput but consume more energy and generate heat — critical for battery-operated devices.
- Performance vs. Cost: faster processors, more memory and dedicated hardware (ASIC/FPGA) cost more; a slower MCU with optimised software may meet needs cheaply.
- Cost vs. Time-to-Market: custom silicon lowers per-unit cost but takes long to develop; off-the-shelf MCUs and existing software/RTOS speed up release at higher unit cost.
- Hardware vs. Software realization: putting a function in hardware gives speed and determinism but increases cost and reduces flexibility; software is flexible and cheap to change but slower.
- Power vs. Cost: ultra-low-power parts and power-management circuitry add cost.
The designer must balance these competing factors to meet the product's market window, budget, and performance/power targets simultaneously.
(a) What is a Real-Time Operating System (RTOS)? Differentiate between hard real-time and soft real-time systems with one practical example of each. [5]
(b) Explain the concept of task scheduling in an RTOS. Compare pre-emptive priority-based scheduling with round-robin scheduling, and explain how priority inversion can occur and how it may be avoided. [7]
(a) RTOS, Hard vs. Soft Real-Time [5]
RTOS: A Real-Time Operating System is an operating system designed to process tasks within strict, predictable (deterministic) time constraints. Its scheduler guarantees that high-priority tasks meet their deadlines; correctness depends not only on the logical result but also on the time at which it is produced.
Hard real-time: Missing a deadline causes total system failure / catastrophe. The deadline is absolute.
- Example: Aircraft flight-control system or automotive airbag deployment.
Soft real-time: Missing a deadline degrades quality of service but is tolerable; the result is still useful if slightly late.
- Example: Video/audio streaming or an online reservation display.
| Aspect | Hard real-time | Soft real-time |
|---|---|---|
| Deadline | Must always be met | Occasional miss tolerated |
| Effect of miss | System failure | Degraded performance |
| Example | Airbag, ABS | Media streaming |
(b) Task Scheduling [7]
Task scheduling is the activity of deciding which ready task the CPU executes next, so that timing requirements are satisfied.
Pre-emptive priority-based scheduling: each task has a priority; the scheduler always runs the highest-priority ready task and pre-empts a lower-priority running task when a higher-priority one becomes ready. Gives fast response to urgent tasks; risk of starving low-priority tasks.
Round-robin scheduling: tasks of equal priority each get a fixed time slice (quantum) in turn, cycling through the ready queue. Fair sharing, but not ideal when some tasks are more urgent than others; response time depends on the number of tasks.
| Pre-emptive priority | Round-robin | |
|---|---|---|
| Basis | Priority | Equal time slices |
| Response to urgent task | Very fast | Depends on queue length |
| Fairness | Low (priority bias) | High (equal sharing) |
| Risk | Starvation of low priority | Poor for hard deadlines |
Priority inversion: occurs when a high-priority task is blocked waiting for a resource (e.g. a mutex) held by a low-priority task, while a medium-priority task pre-empts the low-priority task — so the high-priority task is effectively delayed by a medium one (famous Mars Pathfinder bug).
Avoidance techniques:
- Priority Inheritance: the low-priority task holding the resource temporarily inherits the priority of the highest task waiting for it, so it finishes quickly and releases the resource.
- Priority Ceiling Protocol: each shared resource is given a priority ceiling equal to the highest priority of any task that may use it; a task acquiring it runs at that ceiling, preventing inversion and deadlock.
Consider an 8051-family microcontroller used in an embedded application.
(a) With a block diagram, describe the internal architecture of the 8051 microcontroller, including its CPU, on-chip memory organization, timers, and I/O ports. [6]
(b) Write an embedded C program for the 8051 to generate a square wave of approximately 1 kHz on a port pin using one of its on-chip timers in mode 1. State the assumptions you make about the crystal frequency. [4]
(a) 8051 Internal Architecture [6]
Block diagram (described): An 8-bit CPU (ALU + accumulator A, B register, PSW) is connected to on-chip memory (4 KB ROM and 128 bytes RAM), two 16-bit Timers/Counters (T0, T1), a full-duplex serial port (UART), an interrupt control unit, and four 8-bit I/O ports (P0–P3), all linked by an internal bus, with an oscillator/clock circuit.
+-------------------- Internal Bus --------------------+
| | | | | |
[ CPU ] [ 4KB ROM ] [128B RAM] [Timer0/1] [ UART ] [Interrupts]
ALU,A,B |
| |
[ P0 ] [ P1 ] [ P2 ] [ P3 ] <- four 8-bit I/O ports
[ Oscillator / Clock ]
- CPU: 8-bit ALU, accumulator (A), B register, PSW (flags), program counter, stack pointer.
- On-chip memory: 4 KB internal ROM (program), 128 bytes internal RAM (registers banks, bit-addressable area, scratchpad). Separate program and data memory (Harvard-style).
- Timers: two 16-bit timer/counters T0 and T1, usable as timers or event counters.
- I/O ports: P0, P1, P2, P3 — four 8-bit bidirectional ports (P0/P2 also serve as the external address/data bus).
(b) 1 kHz Square Wave using Timer Mode 1 [4]
Assumptions: Crystal frequency = 12 MHz, so machine cycle = 12/12 MHz = 1 µs. A 1 kHz square wave has period 1 ms, i.e. 0.5 ms HIGH and 0.5 ms LOW. For each half: 500 µs / 1 µs = 500 counts. Reload value = 65536 − 500 = 65036 = 0xFE0C → TH = 0xFE, TL = 0x0C.
#include <reg51.h>
sbit out = P1^0; // output pin
void timer0_delay(void) { // ~500 us delay, Timer0 Mode 1
TMOD = 0x01; // Timer0, mode 1 (16-bit)
TH0 = 0xFE; // load 65036 = 0xFE0C
TL0 = 0x0C;
TR0 = 1; // start timer
while (TF0 == 0); // wait for overflow
TR0 = 0; // stop timer
TF0 = 0; // clear overflow flag
}
void main(void) {
while (1) {
out = ~out; // toggle pin every 500 us -> 1 kHz
timer0_delay();
}
}
Toggling the pin every 500 µs produces a full period of 1 ms ≈ 1 kHz.
Section B: Short Answer Questions
Attempt all / any as specified.
Compare the I2C and SPI serial communication protocols with respect to number of signal lines, addressing mechanism, speed, and the typical number of devices that can be connected on the bus. State one suitable application for each.
I2C vs. SPI Comparison
| Parameter | I2C | SPI |
|---|---|---|
| Signal lines | 2 (SDA = data, SCL = clock) | 4 (MOSI, MISO, SCLK, SS/CS) |
| Addressing | Software address (7- or 10-bit) sent on the bus; no extra pin per device | Hardware chip-select (SS) line per slave |
| Speed | Slower: 100 kbps (standard), 400 kbps (fast), up to 3.4 Mbps (high-speed) | Faster: typically several Mbps to tens of Mbps |
| No. of devices | Many (up to 112 with 7-bit addressing) sharing only 2 wires | Limited by available chip-select pins (one per slave) |
| Mode | Half-duplex, multi-master capable | Full-duplex, single master |
Suitable applications:
- I2C: reading low-speed on-board sensors (e.g. RTC, EEPROM, temperature/accelerometer) where many devices share two wires.
- SPI: high-speed peripherals such as SD cards, TFT displays, and ADCs where throughput matters.
(a) Explain the frame format of asynchronous UART communication, identifying the start bit, data bits, parity bit, and stop bit(s). [4]
(b) Calculate the time required to transmit one byte of data using a UART configured at 9600 baud, 8 data bits, no parity, and 1 stop bit. [2]
(a) UART Asynchronous Frame Format [4]
UART sends one character as a serial frame; the line idles HIGH.
IDLE | START | D0 D1 D2 D3 D4 D5 D6 D7 | PARITY | STOP | IDLE
1 | 0 | <-- data bits (LSB first) --> | P | 1 |
- Start bit: one bit, always logic 0, marks the beginning of a frame and synchronises the receiver.
- Data bits: 5–9 bits (commonly 8), transmitted LSB first, carrying the actual character.
- Parity bit (optional): one bit for error detection (even/odd parity); may be omitted.
- Stop bit(s): 1, 1.5 or 2 bits, always logic 1, mark the end of the frame and allow the receiver to resynchronise.
No separate clock line is used — both ends must agree on the same baud rate.
(b) Time to Transmit One Byte [2]
Configuration: 8 data bits, no parity, 1 stop bit → total bits per frame = 1 (start) + 8 (data) + 0 (parity) + 1 (stop) = 10 bits.
(a) What is an interrupt? Differentiate between maskable and non-maskable interrupts. [3]
(b) Explain the sequence of steps a microcontroller performs when an interrupt occurs, including the role of the Interrupt Service Routine (ISR) and the importance of saving and restoring context. [3]
(a) Interrupt; Maskable vs. Non-Maskable [3]
Interrupt: a hardware or software signal that temporarily suspends the normal execution of the CPU so that it can service an urgent event, after which it resumes the interrupted program. Interrupts allow asynchronous, event-driven response without continuous polling.
- Maskable interrupt: can be enabled or disabled (masked) by software through the interrupt-enable flags/registers. Used for ordinary peripheral events (timer, UART, external pins).
- Non-maskable interrupt (NMI): cannot be disabled by software; always serviced. Reserved for critical events such as power failure, watchdog reset, or hardware errors.
(b) Interrupt Handling Sequence [3]
When an interrupt occurs the microcontroller performs:
- Finish current instruction and recognise the interrupt request.
- Save context: push the Program Counter (return address) and processor status/registers onto the stack so the interrupted program can be resumed exactly.
- Disable further interrupts (or set appropriate priority) and load the ISR address from the interrupt vector table into the PC.
- Execute the ISR (Interrupt Service Routine) — the dedicated function that handles the event (e.g. read data, clear flags).
- Restore context: pop the saved registers and PC from the stack and re-enable interrupts (via the
RETI/return-from-interrupt instruction). - Resume the interrupted main program from where it left off.
Importance of saving/restoring context: the ISR uses the same CPU registers as the main program; saving them on entry and restoring on exit ensures the main program continues with its data intact and unaffected by the interrupt.
Describe how an analog temperature sensor (such as an LM35) is interfaced to a microcontroller. Explain the role of the ADC, the need for signal conditioning, and how the digital reading is converted back into a temperature value in degrees Celsius.
Interfacing an Analog Temperature Sensor (LM35) to a Microcontroller
Sensor characteristics: The LM35 is a linear analog temperature sensor whose output voltage is directly proportional to temperature: 10 mV per °C (e.g. 25 °C → 250 mV), with a 0 V output at 0 °C.
Interfacing steps:
- Analog output: The LM35 produces a small analog voltage on its output pin. This is fed to an analog input channel of the microcontroller.
- Signal conditioning (need): Because the output change is only 10 mV/°C — a small range relative to the ADC's full-scale (often 5 V) — an amplifier (op-amp gain stage) may be used to scale the signal to better fill the ADC range and improve resolution. A simple RC low-pass filter removes electrical noise, and the signal is kept within the ADC's input range.
- ADC role: The Analog-to-Digital Converter samples the (conditioned) analog voltage and converts it into an n-bit digital number proportional to the input voltage. With a reference voltage and resolution bits, the step size is .
- Conversion back to temperature: The digital count is converted to voltage and then to °C:
Example: 10-bit ADC (), V, ADC reading = 51 → V = 249 mV → .
A DC motor and a relay-driven load are to be controlled by a microcontroller.
(a) Explain why a driver circuit (e.g. transistor/ULN2003 or an H-bridge) is required between the microcontroller pin and the actuator. [3]
(b) Explain how Pulse Width Modulation (PWM) is used to control the speed of a DC motor. [3]
(a) Why a Driver Circuit is Required [3]
A microcontroller I/O pin can only source/sink a few milliamperes at logic-level voltage (e.g. 5 V, ~20 mA max). Motors, relays and similar actuators need much higher current (hundreds of mA to amperes) and sometimes higher voltage. Therefore a driver circuit is placed between the pin and the actuator to:
- Amplify current/voltage so the actuator gets enough power (a transistor or ULN2003 Darlington array switches the high-current load while the MCU pin only controls the base).
- Provide electrical isolation/protection for the sensitive MCU, including a flyback (free-wheeling) diode across inductive loads (relay/motor coil) to absorb the back-EMF when switched off, protecting the driver and MCU.
- An H-bridge additionally allows the DC motor to run in both directions by reversing the polarity across it.
(b) PWM Speed Control of a DC Motor [3]
Pulse Width Modulation (PWM) controls average power delivered to the motor by switching the supply ON and OFF rapidly at a fixed frequency and varying the duty cycle (the fraction of each period the signal is HIGH).
- A higher duty cycle → higher average voltage → motor runs faster.
- A lower duty cycle → lower average voltage → motor runs slower.
Because the switching frequency is much higher than the motor's mechanical response time, the motor's inductance/inertia smooths the pulses, so the motor sees an effective average voltage. PWM is efficient because the switching transistor is either fully ON or fully OFF, dissipating little power (unlike a series resistor).
Explain bit manipulation in embedded C programming. Show, with code fragments, how to set, clear, toggle, and test a particular bit of an 8-bit hardware register without affecting the other bits.
Bit Manipulation in Embedded C
In embedded C, hardware registers are accessed bit-by-bit using bitwise operators so that only the target bit is changed and the others are preserved. Assume an 8-bit register REG and we want to operate on bit position n.
Set a bit (make it 1) — OR with a mask:
REG |= (1 << n); // set bit n, others unchanged
Clear a bit (make it 0) — AND with the inverted mask:
REG &= ~(1 << n); // clear bit n, others unchanged
Toggle a bit (flip it) — XOR with a mask:
REG ^= (1 << n); // toggle bit n, others unchanged
Test/read a bit — AND with a mask and check the result:
if (REG & (1 << n)) {
// bit n is 1 (set)
} else {
// bit n is 0 (clear)
}
Why it works: (1 << n) builds a mask with a single 1 at position n. OR sets, AND-with-complement clears, XOR toggles, and AND tests — each affecting only bit n while leaving all other bits intact, which is essential when configuring hardware registers (e.g. setting one GPIO pin without disturbing others).
Explain the producer-consumer problem in the context of a multitasking embedded system. Describe how inter-task communication and synchronization mechanisms such as semaphores, mutexes, and message queues can be used to solve it safely.
Producer-Consumer Problem in a Multitasking Embedded System
Problem: One or more producer tasks generate data and place it into a shared bounded buffer, while one or more consumer tasks remove and process it. Two hazards arise:
- Race condition: if producer and consumer access the shared buffer simultaneously, the data may be corrupted.
- Synchronisation: the producer must wait when the buffer is full; the consumer must wait when the buffer is empty.
In an embedded RTOS this is common, e.g. an ISR/sensor task producing samples that a processing task consumes.
Solving it with RTOS primitives:
- Mutex (mutual exclusion): protects the critical section — the code that updates the shared buffer/indices. A task locks the mutex before access and unlocks after, guaranteeing only one task modifies the buffer at a time. Mutexes typically support priority inheritance to avoid priority inversion.
- Counting semaphores: used for synchronisation/flow control. Use two:
empty(initialised to buffer size) — producer takes it before writing (blocks when buffer full).full(initialised to 0) — producer gives it after writing; consumer takes it before reading (blocks when buffer empty).
- Message queue: the cleanest RTOS solution — a built-in thread-safe FIFO. The producer calls
queue_send()(blocks/returns if full) and the consumer callsqueue_receive()(blocks until an item is available). The queue internally handles both mutual exclusion and the full/empty blocking, so the application code stays simple and safe.
Pseudocode (semaphore + mutex):
Producer: Consumer:
wait(empty); wait(full);
lock(mutex); lock(mutex);
buffer.put(item); item = buffer.get();
unlock(mutex); unlock(mutex);
signal(full); signal(empty);
This ensures safe, deadlock-free data exchange between concurrent tasks.
Differentiate between the following pairs as applied to embedded processors:
(a) Microprocessor and Microcontroller. [2]
(b) Harvard architecture and Von Neumann architecture. [2]
(c) RISC and CISC instruction set architectures. [2]
(a) Microprocessor vs. Microcontroller [2]
| Microprocessor | Microcontroller |
|---|---|
| Only a CPU on the chip; RAM, ROM, I/O, timers are external | CPU + RAM + ROM/Flash + I/O ports + timers + peripherals on a single chip |
| General-purpose (PCs, computing) | Dedicated for embedded control |
| Higher cost, more power, larger board | Low cost, low power, compact (System-on-Chip) |
| e.g. Intel Core, Pentium | e.g. 8051, AVR, PIC |
(b) Harvard vs. Von Neumann Architecture [2]
| Harvard | Von Neumann |
|---|---|
| Separate memories and buses for program and data | Single shared memory and bus for program and data |
| Instruction fetch and data access can occur simultaneously → faster | Fetch and data access cannot overlap (bus bottleneck) |
| Used in most microcontrollers/DSPs (8051, AVR) | Used in general-purpose CPUs |
(c) RISC vs. CISC [2]
| RISC | CISC |
|---|---|
| Reduced, simple fixed-length instruction set | Large, complex variable-length instruction set |
| Most instructions execute in one cycle; relies on registers and load/store | Instructions may take many cycles; complex memory-to-memory ops |
| Simpler hardware, easier pipelining, more registers | More complex control unit (microcode), fewer registers |
| e.g. ARM, AVR, MIPS | e.g. x86, 8051 |
Compare polling and interrupt-driven approaches for handling I/O in an embedded system. Discuss the advantages and disadvantages of each in terms of CPU utilization and response time.
Polling vs. Interrupt-Driven I/O
Polling: the CPU repeatedly checks (in a loop) the status flag of a device to see whether it needs servicing.
Interrupt-driven: the device signals the CPU (raises an interrupt) only when it needs attention; the CPU runs other code meanwhile and jumps to the ISR when interrupted.
| Aspect | Polling | Interrupt-driven |
|---|---|---|
| CPU utilisation | Poor — CPU wastes cycles continuously checking, even when no event occurs | Efficient — CPU does useful work and is freed until an event happens |
| Response time | Depends on polling rate; may miss/delay fast events | Fast and bounded — serviced almost immediately on the event |
| Complexity | Simple to program | Needs ISR, vector setup, context saving |
| Determinism / overhead | Predictable timing; no interrupt overhead | Slight overhead per interrupt (context switch) |
| Power | Higher (CPU always busy) | Lower (CPU can sleep until interrupt) |
Summary: Polling is simple and acceptable for slow or frequently-active devices, but wastes CPU time and can be slow to respond. Interrupt-driven I/O gives much better CPU utilisation, lower power, and faster, more deterministic response, at the cost of extra programming complexity, so it is preferred for time-critical or infrequent events.
Frequently asked questions
- Where can I find the BE Computer Engineering (IOE, TU) Embedded System (IOE, CT 655) question paper 2078?
- The full BE Computer Engineering (IOE, TU) Embedded System (IOE, CT 655) 2078 (regular) question paper is available free on Kekkei. You can read every question online and attempt the paper under timed exam conditions.
- Does the Embedded System (IOE, CT 655) 2078 paper come with solutions?
- Yes. Every question on this Embedded System (IOE, CT 655) past paper includes a step-by-step solution, plus instant AI feedback when you attempt it on Kekkei.
- How many marks is the BE Computer Engineering (IOE, TU) Embedded System (IOE, CT 655) 2078 paper?
- The BE Computer Engineering (IOE, TU) Embedded System (IOE, CT 655) 2078 paper carries 80 full marks and is meant to be completed in 180 minutes, across 13 questions.
- Is practising this Embedded System (IOE, CT 655) past paper free?
- Yes — reading and attempting this Embedded System (IOE, CT 655) past paper on Kekkei is completely free.