Question: 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

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

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!