Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

ES2C4 Computer Architecture and Systems

Design Assignment January 2023

Assessment Setter: Dr Daciana Iliescu [email protected]

Assessment Weighting: 50%

Target Learning Outcomes:

•   Represent different types of data in binary and perform arithmetic operations on them.

•   Create basic C programs and C programs for microcontrollers. Write microcontroller programs in C that go beyond a single iteration loop, taking advantage of interrupts and timers, and communicating with external peripherals.

Feedback: Brief comments in the feedback textbox on Tabula.

Deadline: 16th March 2023, 12:00pm (midday)

------------------------------------------------------------------------------

Introduction

This assessment is designed to allow you to demonstrate your understanding of the concepts presented in lectures and labs of the ES2C4 Computer Architecture and Systems module. It will also assess your ability to design basic C programs and microcontroller programs using the C programming language, and your ability to use computing resources efficiently.                          The information sources for this assignment should extend beyond the lecture notes and lab briefing sheets.

The  correctness,  structure,  styling  and  comments  of your  program will  be  considered,  as demonstrated by the program code, the design description and the comments, according to the marking scheme.

A  word  document  template,  called  ES2C4_22-23_Design  Assignment  Submission.docx  is provided for your use. It also contains brief instructions for the content under each section. Enter your answers and all the code relevant to the tasks below according to this template and submit a .pdf version of it. DO NOT submit a screenshot of your code since it cannot be run. DO NOT exceed 10 pages for the report, including code.

Task 1  Simplified Wordle game (40 marks)

You are required to develop a computer program, written in the C programming language only, which implements a simplified version of the online word game Wordle. Your software must be  designed  to  run  on  the  online  C  compiler.  You  are  not  required  to  use  multiple header/source files.

In the report, you should briefly describe your program, discuss the details of your design, use a flowchart to describe the logical structure of the program and discuss the correctness, as well as the efficiency of the implementation .

In this game, the computer randomly picks a word from a vocabulary’ list of 20 English words, each of 5 letters, chosen by the programmer.

The user has 6 tries to guess the word.

The computer checks the word entered by the user against its vocabulary’ and displays back the word entered, as follows:

-     when a letter is guessed, and is in the right place, the letter is displayed as uppercase;

-     when a letter is guessed, but is in the wrong place, the letter is displayed as lowercase;

-     when a letter is not guessed, another sign (not letter), chosen by the programmer, is displayed in its place;

When all the letters are guessed correctly, the word is displayed in uppercase and the computer displays a congratulatory message and the number of tries .

If the user has not guessed in 6 tries, the computer displays an apologetic message.                  A further simplification is that the computer does not check if the word entered by the user makes sense  in  English,  but only that  it contains  English  letters and  not other characters. Further code, at the discretion of the programmer, could be written to handle this case.

You can find the official Wordle game at https://www.nytimes.com/games/wordle/index.html

Task 2  Simple lights game (60 marks)

You are required to develop a computer program, written in the C programming language only, which implements a simple game using LED lights and servo motor. Your software must be designed to  run  on the  ES2C4  Development  Board. You  are  not  required to  use  multiple header/source files.  In the  report, you should  briefly describe your  program  and settings, discuss the detail of your design, including the clocks, timing signals, peripherals and their configuration and discuss the correctness, as well as the efficiency of the implementation .

In this game, the Red, Yellow, Green and Amber LEDs from the ES2C4 development board act as a binary number display, for bit 3, 2, 1 and 0, respectively, of a hex-digit. An LED is lit when the corresponding bit is 1, and is unlit when the corresponding bit is 0, as in figure below.

 

The Green Button sets the display, ie lights up the LEDs according to the binary number N. The Red Button resets the display, ie brings all the bits to zero.

If the display has been lit for some time, T1, the display will reset automatically, then the Yellow LED will start blinking. It will blink for a time T2, at a rate of 5 Hz, then reset automatically.       However, if the Orange Button is pressed while the Yellow LED is blinking, the barrier controlled by the PWM (servo motor) will raise. After a time T3, the barrier will lower and the display will reset. With each successful barrier raise, the blinking interval will shorten by 25% of the original value T2. The barrier should not raise if the Orange Button is pressed outside the interval T2.  The game is stopped and reset when the user presses the Red Button.

To play the game, a user presses the Green Button, then waits for the Yellow LED to blink and presses the Orange Button once to try to raise the barrier. The user has multiple tries, until they win or press the Red Button to end the game.

The game is won by the user who manages to raise the barrier 3 times. At this point, all the display’s LEDs will blink in acknowledgement for 3 seconds at a rate of 2 Hz, then the whole game resets.

The table overleaf describes the peripheral configuration that must be used in the coursework. You must use the correct configuration and only the peripherals mentioned in the table.

Peripheral

Odd configuration

Even configuration

Red LED

PB_1

PB_4

Yellow LED

PB_6

PB_5

Green LED

PA_11

PA_3

Orange LED

PA_8

PA_4

PWM (servo motor)

PA_6

PA_6

Timer

Timer 7

Timer 6

Red Button

PA_9

PA_9

Orange Button

PA_5

PA_5

Green Button

PB  5

_

PB_6

To select the values for the game, consider your Student ID number, of the format 2xxpqrs and take the last 4 digits marked here with p, q, r and s from it.

e.g. ID number 2013210, p = 3, q = 2, r = 1 and s =  0

Consider that those digits represent hexadecimal digits. If any of the digits is 0, replace its value with hex-digit A’ (decimal 10).

e.g. A16 = 1010 ; p = 316, q =  216, r = 116 and s = 0, therefore s = A16

The Odd’ or ‘Even’ configurations from the table above apply if s is odd, respectively even.      The number to be displayed when the Green Button is pressed, N, is the binary equivalent of the hex-digit s.

T1 is set randomly between 0 and 1r16 seconds.

e.g. r = 116 , T1 is set between 0 and 1116 = 1710 seconds.

T2 is set randomly between 0 and q seconds.

e.g. q = 216 , T2 is set between 0 and 216 = 210 seconds.

T3 is set to p seconds.

e.g. p = 316 , T3 is set to 316 = 310 seconds.

Marking scheme for each Task   to be used in conjunction with the template

Task 1  total 40 marks

Introduction           Design description Discussion

Code

(  3 marks)

(20 marks)

(  7 marks)

(10 marks)

Task 2  total 60 marks

Introduction           Design description Discussion

Code

(  3 marks)

(25 marks)

(17 marks)

(15 marks)

Marks may be deducted if the program does not function as required.

Penalty of 3 marks for each page exceeding the 10 page limit.

Beware of plagiarism !