首页 > > 详细

辅导 MEC302 – Embedded Computer Systems 2023/24 – Semester 2 Assignment 2讲解 R程序

MEC302 - Embedded Computer Systems

2023/24 - Semester 2

Assignment 2 - Programming 8051 microcontroller

Remarks:

1. The assignment is worth 10% of the module mark.

2. The assignment tasks are designed to be implemented (i.e., programmed) in Keil uVision 5 and emulated on edSim51di emulator.

3. Submission deadline is May 12, 23:59. Only submit to LM.

4. Late submissions will be penalized according to the University policy:

•   5% deduction for each working day after the submission deadline;

•   work received more than five working days after the submission deadline will receive a mark of zero.

Instructions:

1. The assignment contains two tasks to program  8051 microcontroller  with peripheral  devices emulated in edSim51di.

2. Question 1 is worth 30%, Question 2 is worth 30%, Question 3 is worth 30%, and Report is worth 10%.

3. For each task you must submit one Embedded C program (.c file) for 8051 microcontroller with the following name pattern: student-id_task-number.c . Do not submit any other file formats as

it will be impossible to compile them!

4. You need to write a report consisting of

a.   Flow chart for each question.

b.   Explanation of the program. You should make comments in your embedded C code. The more

comments you make the easier it will be for the instructor to follow.

5. Put all the .cfiles and report in one ZIP file.

6. The submitted files will be compiled by the TAs using Cx51 compiler by Keil uVision 5 and tested on edSim51di emulator to check if your programs meet all requirements set in tasks.

AVOID HARD CODING!!

Hard coding refers to the practice of embedding fixed values directly into the source code of a program or system, rather than using variables or configuration files. These fixed values are typically constants, literals, or specific data that remain unchanged during the execution of the program.

Programming task 1

Switches are connected to port P2. LEDs are connected to the P1 port.

1)  Press 0: LED1 is ON

2)  Press 1: LED2 is ON

3)  Press 2: LED3 is ON

4)  Press 3: LED4 is ON

5)  Press 4: LED5 is ON

6)  Press 5: LED6 is ON

7)  Press 6: LED7 is ON

8)  Press 7: all LED is ON

Programming task 2

Switches are connected to port P2. 7-segment is connected to the P1 port.

The 7-segment will display one number higher than the one pressed.

For example, when you press “2”, the 7-segment will display “3” .

Programming task 3

You are asked to control the motor. The switches are connected to P2.

1)  Press the key Switch 0 and turn the motor X rotations in the clockwise direction and then stop.

2)  Press the key Switch 1, turn the motor X rotations in the counter clockwise direction and then stop.

X = last digit of your student ID. If it is 0, replace it with 5.






联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!