0% found this document useful (0 votes)
2 views

PP2

The document outlines the examination details for the course BAC 3209/BSD 3205: Embedded Systems for the 2023/2024 academic year, including instructions for answering questions. It contains four main questions covering topics such as embedded systems programming, traffic light control systems, parking space occupancy algorithms, and an automated plant watering system. Each question includes specific tasks and requirements for students to demonstrate their understanding of embedded systems concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

PP2

The document outlines the examination details for the course BAC 3209/BSD 3205: Embedded Systems for the 2023/2024 academic year, including instructions for answering questions. It contains four main questions covering topics such as embedded systems programming, traffic light control systems, parking space occupancy algorithms, and an automated plant watering system. Each question includes specific tasks and requirements for students to demonstrate their understanding of embedded systems concepts.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

UNIVERSITY EXAMINATIONS: 2023/2024

EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE IN


SOFTWARE DEVELOPMENT/BAC
BAC 3209/ BSD 3205: EMBEDDED SYSTEMS
FULLTIME/ PART-TIME/DISTANCE LEARNING
DATE: APRIL 2024 TIME: 2 HOURS

INSTRUCTIONS: Question One Is Compulsory, Choose Two Other Questions

QUESTION ONE (20 marks) Compulsory


a) Consider the following embedded system with a dial that can set A3..A0 to binary 0 to 9, and a 7-
segment display (Wikipedia: 7-Segment Display) connected to B6..B0 as shown:

Below is a (partial) RIM C program that appropriately sets the display for the given dial position:
#include "RIMS.h"
void main()
{
while (1) {
switch( A )
{
case 0 : B = 0x77; break; // 0111 0111 (0)
case 1 : B = 0x24; break; // 0010 0100 (1)
case 2 : B = 0x5D; break; // 0101 1101 (2)
//...
case 9 : B = 0x6F; break; // 0110 1111 (9)
default: B = 0x5B; break; // 0101 1011 (E for Error)
}
}
}

i) What B_ outputs should be set to 1 for case 3? List in ascending order separated by
spaces, e.g., B0 B2 ... [2 marks]
ii) To what should B be set for case 3? B = ____; Use uppercase letters for the hex literal.
[2 marks]
b) Design a state machine for a simple traffic light control system with three states: Green, Yellow, and
Red. The system should transition between states in the traditional sequence, with timers controlling the
duration of each state.
i. State Diagram: Draw a state diagram for the traffic light control system. Label each state and
transition clearly. [3 marks]
ii. State Transition Table: Create a state transition table that includes current states, input (timer
expiration), and next states. [4 marks]
iii. Implementation: Write pseudocode for the state machine. Include initialization, state transitions,
and timer management. [5 marks]
iv. Enhancements: Suggest one enhancement to improve traffic flow or safety and describe how it
can be integrated into the current state machine model. [4 marks]

QUESTION TW0 (15 marks)


Eight parking spaces in an intelligent parking lot are equipped with sensors. These sensors are connected to
input A of an embedded system. Each sensor outputs a value of '1' if the space is occupied and '0' if it is
vacant.
Task:
Develop a program for the embedded system that accomplishes the following objectives:
a) Sensor Data Reading: Utilize the GetBit() function to read the status of each parking space sensor
connected to input A. Briefly describe how the GetBit() function works in this context. [3 marks]
b) Occupancy Count Algorithm: Write a segment of code that iterates through each sensor's status to count
the number of occupied spaces. The total should be stored in variable B. [4 marks]
c) Optimization: Propose a method to optimize your program for efficiency or speed. Discuss why your
proposed optimization could be beneficial in an embedded systems environment. [5 marks]
d) Error Handling: Implement error handling in your program to manage potential issues, such as a sensor
failure. Describe the approach and how it ensures the reliability of the occupancy count. [3 marks]
Additional Instructions:
• Provide comments in your code explaining the logic of each major step.

QUESTION THREE (15 marks)


Given the following timing diagram and the light on/off SM, determine the value of B0 at the
specified times.

i) 0 s [3 marks]
ii) 1 s [3 marks]
iii) 2 s [3 marks]
iv) 3 s [3 marks]
v) 4 s [ 3 marks]
QUESTION FOUR (15 marks)
Design and implement an automated plant watering system using Arduino. This system should monitor soil
moisture levels and automatically water the plant when the soil is dry.
a) System Design: Sketch the circuit diagram for connecting the soil moisture sensor and water pump
to the Arduino. Include a brief description of how each component interacts with the Arduino.
[3 marks]
b) Programming Logic: Write an Arduino program that reads the moisture level from the sensor. The
program should activate the water pump when the soil moisture level falls below a predefined
threshold. Include comments to explain the logic of your code. [6 marks]
c) Energy Efficiency: Discuss strategies to make your automated watering system energy-efficient.
Propose at least one method and explain its implementation in the context of your project.
[3 marks]
d) Scalability: Describe how your system could be scaled to manage multiple plants, considering
factors such as circuit complexity and code modifications. [3 marks]
Additional Guidelines:
• Provide a list of materials needed for your project.
• Ensure your code is well-commented to demonstrate your thought process.
• Consider practical aspects such as the water source and how to avoid overwatering.

You might also like