Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine i2a_s(char *a, int myl) that converts a 16-bit integer, myl, into
4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine i2a_s(char *a, int myl) that converts a 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(0]'E', a[1]-'A', a[2]'4', a[3]-'3'. The main program that calls the subroutine is shown belovw Ascii('A'-0x41, ascii('0')-0x30 RESET StoRNDT : . .. #--STACK-END,SP #WDTPWINDTHOLD,&MDTCTL ; Initialize stack pointer ; Stop watchdog timer ; Main code here ; allocate space for ascii chars ; R14 points to the allocated area ; integer is passed through R4 ; push the starting address on the stack Sub.. #4, SP call add jme * R14 #12a. S #2, SP call subroutine ; free space on the stack lend: 0x34AE ; Stack Pointer definition .global STACK END .sect .stack ; Interrupt Vectors sect ".reset" ; MSP430 RESET Vector RES--- 12a s: 4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine i2a_s(char *a, int myl) that converts a 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(0]'E', a[1]-'A', a[2]'4', a[3]-'3'. The main program that calls the subroutine is shown belovw Ascii('A'-0x41, ascii('0')-0x30 RESET StoRNDT : . .. #--STACK-END,SP #WDTPWINDTHOLD,&MDTCTL ; Initialize stack pointer ; Stop watchdog timer ; Main code here ; allocate space for ascii chars ; R14 points to the allocated area ; integer is passed through R4 ; push the starting address on the stack Sub.. #4, SP call add jme * R14 #12a. S #2, SP call subroutine ; free space on the stack lend: 0x34AE ; Stack Pointer definition .global STACK END .sect .stack ; Interrupt Vectors sect ".reset" ; MSP430 RESET Vector RES--- 12a s
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