0% found this document useful (0 votes)
19 views3 pages

INSTRUCTIONS: Question One Is Compulsory, Choose Two Other Questions QUESTION ONE (20 Marks) Compulsory

The document outlines the examination structure for a Bachelor's degree in Applied Computing/Software Development, specifically for the Embedded Systems course. It includes various questions covering topics such as the differences between embedded systems and general-purpose computers, Arduino programming, state machines, and digital signal processing. Students are required to answer a compulsory question and select two additional questions from the provided options.
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)
19 views3 pages

INSTRUCTIONS: Question One Is Compulsory, Choose Two Other Questions QUESTION ONE (20 Marks) Compulsory

The document outlines the examination structure for a Bachelor's degree in Applied Computing/Software Development, specifically for the Embedded Systems course. It includes various questions covering topics such as the differences between embedded systems and general-purpose computers, Arduino programming, state machines, and digital signal processing. Students are required to answer a compulsory question and select two additional questions from the provided options.
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/ 3

UNIVERSITY EXAMINATIONS: 2022/2023

EXAMINATION FOR BACHELORS DEGREE IN APPLIED


COMPUTING/SOFTWARE DEVELOPMENT
BAC 3203/ BSD 3205: EMBEDDED SYSTEMS
FULL TIME/ PART TIME
ORDINARY EXAMINATION
DATE: APRIL 2023 TIME: 2 HOURS

INSTRUCTIONS: Question One Is Compulsory, Choose Two Other Questions

QUESTION ONE (20 marks) Compulsory


a) Explain how an embedded system differs from a general-purpose computer.
[2 marks]
b) Determining the minimum pulse duration to be detected sometimes requires calculation.
Consider a sensor in a street used to count the number of cars that pass over the sensor. If the
sensor detects just a single point above the sensor, the shortest car is 6 feet long, and the
fastest speed to be considered is 200 mph, calculate the minimum pulse duration for a single
car passing over the sensor. [6 marks]
c) Name and explain Four characteristics of embedded systems [4 marks]
d) Discuss the purpose of the setup() and loop() functions in an Arduino sketch and explain how
they are used. Give an example. [4 marks]
e) An Arduino board can be used to read data from a temperature sensor, such as a thermistor,
and display the readings on the Serial Monitor using the analogRead() and Serial.print()
functions. The analogRead() function is used to read the voltage level at an analog input pin,
and the value can be converted to a temperature reading using an appropriate equation. The
Serial.print() function is used to send the temperature data to the Serial Monitor for display.
Using the above explanation, write an Arduino code that reads data from a temperature
sensor and displays the reading on a Serial Monitor. [4 marks]

QUESTION TW0 (15 marks)


a) An Arduino board can be used to control a LED based on the readings from a light
sensor, such as a photoresistor, by reading the sensor data and using an if statement to
turn the LED on or off based on the sensor value. The analogRead() function is used to
read the sensor data, and the digitalWrite() function is used to set the state of the LED.
Write an Arduino code that can be used to control an LED based on the readings from a
light sensor. [6 marks]
b) Implement a synchSM in C for the following toggle system, wherein a first button press
on A0 sets B0 to 1, a second sets B0 to 0, a third to 1, etc. Assume the button may bounce
for up to 20 ms. Assume the maximum latency between a press and toggle should be 50
ms. Assume button presses last at least 250 ms and are separated by at least 500 ms.
Choose a good period for the synchSM. Also describe why a much smaller period or a
much larger period would be bad.

Here are the steps to design the toggle system:


Step 1: Define the states of the synchSM
In this system, we need to keep track of the current state of the toggle. We can use a state
variable 'state' to represent the current state. Since the system has only two possible
states, we can use a simple binary state encoding: 0 for the 'off' state and 1 for the 'on'
state.
Step 2: Define the inputs and outputs of the synchSM
The input to the synchSM is the button press on A0. The output is the value of B0, which
needs to be toggled based on the state of the system.
Step 3: Determine the transition conditions
When a button press is detected, the synchSM should transition to the next state and
toggle the output B0. We also need to ensure that the system meets the requirements of
the problem statement:
• Button press may bounce for up to 20 ms: We can use a debouncing circuit or
software algorithm to filter out any bouncing.
• Maximum latency between a press and toggle should be 50 ms: We can use a
timer to ensure that the toggle happens within 50 ms of a button press.
• Button presses should last at least 250 ms and be separated by at least 500 ms: We
can use a timer to ensure that a button press lasts at least 250 ms and that there is
at least 500 ms between successive button presses.
Step 4: Implement the synchSM in C [9 marks]

QESTION THREE (15 marks)


a) Explain what a state machine and how it is used in embedded systems. [5 marks]
b) Explain how state machines be used to control the behavior of an embedded system with
multiple inputs and outputs. Draw a simple illustration [5 marks]
c) State machines can be used to design a finite state machine (FSM) for a simple traffic
light controller system by defining the states that represent the different light sequences,
and transitions between the states that are triggered by time or other events. In the case of
a traffic light controller, the states could represent the red, yellow, and green lights, and
the transitions could be triggered by a timer or a sensor that detects the presence of
vehicles. A state machine diagram can be used to visualize the states and transitions, and
the logic for the state machine can be implemented in code to control the behavior of the
system. Draw a FSM for a simple traffic light controller. [5 marks]

QUESTION FOUR (15 marks)


a) Write a program for an embedded system using C program. Define a constant N to
represent the number of temperature conversions to be performed. Then, define an array
celsius of size N to store the temperature values in Celsius, and an array fahrenheit of size
N to store the converted temperature values in Fahrenheit.
Convert the Celsius to Fahrenheit using the formula fahrenheit = (celsius * 9.0 / 5.0) +
32.0. Print the temperature conversions by printing the values in the celsius and
fahrenheit arrays. [6 marks]
b) Digital signal processing (DSP) is a crucial aspect of embedded systems design,
especially when sensors and actuators are involved. DSP enables real-time processing
and analysis of signals from sensors and helps to make more informed decisions based on
the sensor data. This leads to improved system performance, accuracy, and reliability.
Name and explain three advantages and three disadvantages of using DSP in embedded
system. [9 marks]

You might also like