Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 correspoding to

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 correspoding to the hexadecimal representation of the integer.

image text in transcribed

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, 2', a[3]-'3'. The main program that calls the subroutine is shown below Ascii('A')-0x41, ascii('0')-0x30 RESET: stopNDT : mov.w # STACK END , SP j Initialize stack pointer mov.w #WDTPWINDTHOLD,&NDTCTL ; Stop watchdog timer ; Main code here sub.w #4, SP mo ; allocate space for ascii chars 5 R14 points to the allocated area v.W SP, R14 mov.w myI, R4 push. R14 call #12as add "w #2, SP jmp $ Integer is passed through R4 ; push the starting address on the stack ; call subroutine ; free space on the stack - lend: myI: ; Stack Pointer definition word 0x34AE global STACK END sect .stack 5 Interrupt Vectors .Sect" reset" ; MSP430 RESET Vector short RESET i2a 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, 2', a[3]-'3'. The main program that calls the subroutine is shown below Ascii('A')-0x41, ascii('0')-0x30 RESET: stopNDT : mov.w # STACK END , SP j Initialize stack pointer mov.w #WDTPWINDTHOLD,&NDTCTL ; Stop watchdog timer ; Main code here sub.w #4, SP mo ; allocate space for ascii chars 5 R14 points to the allocated area v.W SP, R14 mov.w myI, R4 push. R14 call #12as add "w #2, SP jmp $ Integer is passed through R4 ; push the starting address on the stack ; call subroutine ; free space on the stack - lend: myI: ; Stack Pointer definition word 0x34AE global STACK END sect .stack 5 Interrupt Vectors .Sect" reset" ; MSP430 RESET Vector short RESET i2a s

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

How wide are Salary Structure Ranges?

Answered: 1 week ago