Question: 1. Write a subroutine that adds two 16-bit unsigned numbers. The value of the addition is assigned to register r22 r23:r24 (r22 holds the MSB).
1. Write a subroutine that adds two 16-bit unsigned numbers. The value of the addition is assigned to register r22 r23:r24 (r22 holds the MSB). The two numbers are passed to the subroutine using r16:r19. 2. Write a program to find the largest number in an array of 8-bit numbers stored in program memory. 3. In your program memory there are two arrays called "string" which consists of 40 8-bit numbers.You have another array of 5 8-bit numbers called "substring". Write a program that tries to find if the "substring" exists in the "string" array. If "substring" exists then the program stores a 0x01 in register ro else it stores a Ox02 in registers ro. Example String: 1234567890123456789012345678901234567890 Substring: 01234 4. Write a subroutine to perform linear search. Pass the following parameters to your subroutine: a. Address of the array in program memory (r17 r16) b. number you are searching for r18 c. Size of the array r19 The array contains a list of 8-bit integers and the maximum size of the array can be 254. The are searching in the array is also 8-bit wi one element number you de. The subroutine consists of a loop. In one loop iteration, read from the array and compare it with the number we are searching for. If the number we are
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
