Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. (25 points) Design and write an MSP430 assembly language subroutine i2a_s(char*a, int myl) that converts a 16-bit BCD encoded integer, myl, into a character
4. (25 points) Design and write an MSP430 assembly language subroutine i2a_s(char*a, int myl) that converts a 16-bit BCD encoded integer, myl, into a character array with elements corresponding to the decimal representation of the integer. For example, an integer myl=9,246 (0x9246 in memory) is converted into an array with 4 elements as follows: a[0]="6', a[1]='4', a[2]='2', a[3]='9. The main program that calls the subroutine is shown below. Ascii('A')=0x41, ascii('0')=0x30. RESET: Stopilot: mov.W mov. STACK END, SP Initialize stack pointer OTPOTHOLD, BHDTCTL; Stop watchdog timer Main code here sub. 14, SP mov.W SP R14 push.W R14 mov. I. R4 call sila s add. 2, SP Jmps allocate space for ascii chars : R14 points to the allocated area push the starting address on the stack ; integer is passed through R4 call subroutine free space on the stack lend: myI: .word x2C13 Stack Pointer definition .global .sect STACK END stack ; Interrupt Vectors ; MSP430 RESET Vector .sect .reset" Short RESET i2a_s: 4. (25 points) Design and write an MSP430 assembly language subroutine i2a_s(char*a, int myl) that converts a 16-bit BCD encoded integer, myl, into a character array with elements corresponding to the decimal representation of the integer. For example, an integer myl=9,246 (0x9246 in memory) is converted into an array with 4 elements as follows: a[0]="6', a[1]='4', a[2]='2', a[3]='9. The main program that calls the subroutine is shown below. Ascii('A')=0x41, ascii('0')=0x30. RESET: Stopilot: mov.W mov. STACK END, SP Initialize stack pointer OTPOTHOLD, BHDTCTL; Stop watchdog timer Main code here sub. 14, SP mov.W SP R14 push.W R14 mov. I. R4 call sila s add. 2, SP Jmps allocate space for ascii chars : R14 points to the allocated area push the starting address on the stack ; integer is passed through R4 call subroutine free space on the stack lend: myI: .word x2C13 Stack Pointer definition .global .sect STACK END stack ; Interrupt Vectors ; MSP430 RESET Vector .sect .reset" Short RESET i2a_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