Question: Need ASAP! Will rate good right away! 4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine i2a s(char a, int

Need ASAP! Will rate good right away! 4. (25 points) Write asubroutine Design and write an MSP430 assembly language subroutine i2a s(char "a,Need ASAP! Will rate good right away!

4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine i2a s(char "a, int myl) that convertsa 16-bit integer, myl, into a character array with elements corresponding to the hexadecimal representation of the integer. For example, an integer myl-13,486-0x34AE is converted into an array with 4 elements as follows: a[o]-'E' a[1]-'A', a[2]-'4', a[3]-'3'. The main program that calls the subroutine is shown below. Ascii('A')-0x41, ascii('0')-0x30. RESET: mov . w # STACK END , SP ; Initialize stack pointer StopwDT : mov.w #WDTPWIDTHOLD ,6HDTCTL ; Stop watchdog timer ; Main code here sub.w #4,SP mov.w SP, R14 mov.W myI, R4 push.w R14 call add . w #2,SP jmp $ ; allocate space for ascii chars ; R14 points to the allocated area ; integer is passed through R4 ; push the starting address on the stack ; call subroutine ; free space on the stack 12a s lend: myI: .word 0x34AE 4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine i2a s(char "a, int myl) that convertsa 16-bit integer, myl, into a character array with elements corresponding to the hexadecimal representation of the integer. For example, an integer myl-13,486-0x34AE is converted into an array with 4 elements as follows: a[o]-'E' a[1]-'A', a[2]-'4', a[3]-'3'. The main program that calls the subroutine is shown below. Ascii('A')-0x41, ascii('0')-0x30. RESET: mov . w # STACK END , SP ; Initialize stack pointer StopwDT : mov.w #WDTPWIDTHOLD ,6HDTCTL ; Stop watchdog timer ; Main code here sub.w #4,SP mov.w SP, R14 mov.W myI, R4 push.w R14 call add . w #2,SP jmp $ ; allocate space for ascii chars ; R14 points to the allocated area ; integer is passed through R4 ; push the starting address on the stack ; call subroutine ; free space on the stack 12a s lend: myI: .word 0x34AE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!