Introduction
between your initials.
l.d(全是小写,小写的L)
Coursework Assignment
You will need to write an assembly program, which will then be submitted as a single .s file.
You have just under two weeks to complete the assignment. The suggested time to spend on the coursework is 8–10 hours.
In the labs following submission of the coursework, you will review each others programs and provide feedback to each other.
1 Display number
Using the circuit from Lab 5, you should write a program to display the digits of 21029011 on the LEDs.
Have your program write out each digit of your number separately, writing the left-most numerical digit first. For example, if your number is 1070542, then your program will first write out a 1, followed by a 0, then a 7, then a 0, then a 5, then a 4, and finally a 2. Each number should be displayed for 1 second.
2 Display your initials
You should now modify your program so that it also displays a binary encoding of your initials after it has finished displaying your number.
There are many ways to encode alphanumeric characters in binary, the most common is ASCII. However, we will use our own encoding of alphanumeric characters. We will assume an ‘A’ is the decimal value 1, a ‘B’ is 2, a ‘C’ is 3 and so on. In this encoding, ‘Z’ would be 26. Again, you can use the look-up table later in this document to find the equivalent binary values that you will display, and accompanying hexadecimal values.
You should also display a full stop character ‘.’, which we will assume is encoded as the value 27,
For example, Ada Lovelace’s program would first display her number. The program would then
display the value 1 (00001, representing ‘a’), then the value 27 (11011, representing ‘.’), and then the value 12 (01100, representing ’l’).
Decimal Digit Hexademical Equivalent Binary Number Representation
0 0x00 00000000 1 0x01 00000001 2 0x02 00000010 3 0x03 00000011 4 0x04 00000100 5 0x05 00000101 6 0x06 00000110 7 0x07 00000111 8 0x08 00001000 9 0x09 00001001
10 0x0A 00001010 11 0x0B 00001011 12 0x0C 00001100 13 0x0D 00001101 14 0x0E 00001110 15 0x0F 00001111 16 0x10 00010000 17 0x11 00010001 18 0x12 00010010 19 0x13 00010011 20 0x14 00010100 21 0x15 00010101 22 0x16 00010110 23 0x17 00010111 24 0x18 00011000 25 0x19 00011001 26 0x1A 00011010 27 0x1B 00011011
7654321 0
So that we can perceive the Morse code, we will use a unit length of 200 milliseconds (ms). This means the duration of a dot is 200 ms, and a dash is 600 ms.
For example, if your sequence was ABC, then your program would run as follows: 1. Turn ON the LED for 200 ms for the first dot of the letter A
2. Turn OFF the LED for 200 ms for the inter-part space of the letter A
3. Turn ON the LED for 600 ms for the first dash of the letter A
4. Turn OFF the LED for 600 ms for the inter-letter space between the letters A and B 5. Turn ON the LED for 600 ms for the first dash of the letter B
6. … and so forth
7. Until the last dot of letter C
8. Turn OFF the LED for 1400 ms for the inter-word space. 9. Loop back to the beginning of the Morse code sequence
Odd, Even, modulo 5
Extend your program as follows.
• The Morse code sequence should loop 50 times (1–50).
• On odd iterations (1, 3, 5, …, 49) your three characters should be displayed in their normal order.
even or odd. 添加备注,并解释
Once you have this behaviour working, you should again extend your program as follows.
• On iterations that are divisible by 5 (5, 10, 15, …, 50) your program should display a ‘5’ after
奇数循环,顺序演示LEI
– e.g. ABC
• On even iterations (2, 4, 6, …, 50) your three characters should be displayed in reverse order.
偶数循环,倒序演示IEL
– e.g. CBA
Using comments, you should explain how you have implemented the check of whether the iteration is
what would normally be displayed on that iteration. – e.g. ABC5 or CBA5
4 Ping-pong
能够整除5的循环应该在三个字母后显示数字5
Once the Morse code sequence has terminated, your LEDs should display a repeating pattern.
You should use the LEDs to display a ping-pong like pattern, where only a single LED is on at a time, and it appears to move back and forth across the LEDS.
• 1000→0100→0010→0001→0010→0100→1000→…
It is left up to you to determine a suitable time to display each pattern for.
Submission instructions
• You should submit a single .s file named assignment.s.
• DO NOT put your program in a .zip, .7z, or any other archive, DO NOT submit your program
as a .doc, .pdf, or any other format other than .s.
• This coursework uses ‘Model 4’ for use of generative AI. That is, you can use generative AI to
help you with the coursework. However:
– I have tried to use it myself for completing the coursework, it was not very helpful. Do not expect generative AI to spit out complete assembly programs for you.
– You should make it clear in the comments where and how you have used generative AI.
– It is your responsibility to ensure any code produced by generative AI is ‘fair use’.
程序代写 CS代考 加QQ: 749389476