Question
Reminder : To let the user enter data in the MPLAB simulator, set a breakpoint to the next line after ORG 0H. So when you
Reminder : To let the user enter data in the MPLAB simulator, set a breakpoint to the next line after ORG 0H. So when you run the program, it will stop at the beginning of the program. Then you can go to File Registers and enter the data to any address. After that, you can run your program step by step, or click continue (press F5) to see the output. All three tasks need to be implemented with memory operations, otherwise you will not receive any credits.
1. Write a program that combines two memory regions into one memory region with writing nth elements of each memory region to the new memory region consecutively. The first and second lists are started from the address 0x20 and 0x30, respectively. The lengths of lists are the same and stored in the address 0x10 as one byte. The start address of the result should be the same as the address of the first list. In other words, the result list should be written on the first list (Therefore you can use a temporary list for a combination of two lists, then move it to the first lists location). Next, the program should find the average of the new list (combination of two lists) and store the result to the 50H location (You should use the pointer algorithm). Note : Numbers and length of lists (n) should be entered as hex format via MPLAB File Register Section. The length of the lists (n) should be entered to 0x10 location. Example : M[.] indicates the content of address. Old value means the value before the execution of the program. After execution of the program, New value of M[0x20] = Old value of M[0x20] (Write the first element of the first list) New value of M[0x21] = Old value of M[0x30] (Write the first element of the second list) New value of M[0x22] = Old value of M[0x21] (Write the second element of the first list) New value of M[0x23] = Old value of M[0x31] (Write the second element of the second list) ... Lets assume that the numbers (hex) are 1, 3, 5, 7 and 9 (n=5) are stored in the first list which starts from address 0x20 to 0x24. The second list contains (hex) 2, 4, 6, 8 and A (n=5) are stored in the address 0x30 to 0x34. After the execution of the program, the numbers need to be displayed as (hex) 1, 2, 3, 4, 5, 6, 7, 8, 9, A in the address from 0x20 to 0x29. Then, average of the numbers (hex) (1+2+3+...+A)/2n = 5H. Quotient (5H) should be assigned to the 50H location. Note : These numbers are given just for demonstration. You can use the above numbers to test your code. However, the length and the numbers will be defined by the user during lab hours.
Lab Activities Reminder: To let the user enter data in the MPLAB simulator, set a breakpoint to the next line after "ORG OH". So when you run the program, it will stop at the beginning of the program. Then you can go to "File Registers" and enter the data to any address. After that, you can run your program step by step, or click "continue" (press F5) to see the output. All three tasks need to be implemented with memory operations, otherwise you will not receive any credits. 1. Write a program that combines two memory regions into one memory region with writing nth elements of each memory region to the new memory region consecutively. The first and second lists are started from the address 0x20 and 0x30, respectively. The lengths of lists are the same and stored in the address 0x10 as one byte. The start address of the result should be the same as the address of the first list. In other words, the result list should be written on the first list (Therefore you can use a temporary list for a combination of two lists, then move it to the first list's location). Next, the program should find the average of the new list (combination of two lists) and store the result to the 50H location (You should use the pointer algorithm). Note : Numbers and length of lists (n) should be entered as hex format via MPLAB File Register Section. The length of the lists (n) should be entered to Ox 10 location. Example : M[.] indicates the content of address. Old value means the value before the execution of the program. After execution of the program, New value of M[0x20] = Old value of M[0x20] (Write the first element of the first list) New value of M[0x21] = Old value of M[Ox30] (Write the first element of the second list) New value of M[0x22] =Old value of M[0x21] (Write the second element of the first list) New value of M[0x23] = Old value of M[0x31] (Write the second element of the second list) Let's assume that the numbers (hex) are 1, 3, 5, 7 and 9 (n=5) are stored in the first list which starts from address 0x20 to 0x24. The second list contains (hex) 2, 4, 6, 8 and A (n=5) are stored in the address 0x30 to 0x34. After the execution of the program, the numbers need to be displayed as (hex) 1, 2, 3, 4, 5, 6, 7, 8, 9, A in the address from 0x20 to 0x29. Then, average of the numbers (hex)(1+2+3+...+A)/2n=5H. Quotient (5H) should be assigned to the 50H location. Note: These numbers are given just for demonstration. You can use the above numbers to test your code. However, the length and the numbers will be defined by the user during lab hours. Lab Activities Reminder: To let the user enter data in the MPLAB simulator, set a breakpoint to the next line after "ORG OH". So when you run the program, it will stop at the beginning of the program. Then you can go to "File Registers" and enter the data to any address. After that, you can run your program step by step, or click "continue" (press F5) to see the output. All three tasks need to be implemented with memory operations, otherwise you will not receive any credits. 1. Write a program that combines two memory regions into one memory region with writing nth elements of each memory region to the new memory region consecutively. The first and second lists are started from the address 0x20 and 0x30, respectively. The lengths of lists are the same and stored in the address 0x10 as one byte. The start address of the result should be the same as the address of the first list. In other words, the result list should be written on the first list (Therefore you can use a temporary list for a combination of two lists, then move it to the first list's location). Next, the program should find the average of the new list (combination of two lists) and store the result to the 50H location (You should use the pointer algorithm). Note : Numbers and length of lists (n) should be entered as hex format via MPLAB File Register Section. The length of the lists (n) should be entered to Ox 10 location. Example : M[.] indicates the content of address. Old value means the value before the execution of the program. After execution of the program, New value of M[0x20] = Old value of M[0x20] (Write the first element of the first list) New value of M[0x21] = Old value of M[Ox30] (Write the first element of the second list) New value of M[0x22] =Old value of M[0x21] (Write the second element of the first list) New value of M[0x23] = Old value of M[0x31] (Write the second element of the second list) Let's assume that the numbers (hex) are 1, 3, 5, 7 and 9 (n=5) are stored in the first list which starts from address 0x20 to 0x24. The second list contains (hex) 2, 4, 6, 8 and A (n=5) are stored in the address 0x30 to 0x34. After the execution of the program, the numbers need to be displayed as (hex) 1, 2, 3, 4, 5, 6, 7, 8, 9, A in the address from 0x20 to 0x29. Then, average of the numbers (hex)(1+2+3+...+A)/2n=5H. Quotient (5H) should be assigned to the 50H location. Note: These numbers are given just for demonstration. You can use the above numbers to test your code. However, the length and the numbers will be defined by the user during lab hours
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started