Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine 12a_s(char *a, int myl) that converts a 16-bit integer, myi, into

image text in transcribed
4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine 12a_s(char *a, int myl) that converts a 16-bit integer, myi, into a character array with eiements corresponding to the hexadecimal representation of the integer. For example, an integer my 13,486-0x34AE is converted into an array with 4 elements as follows: alol-E', a[1] 'A', a[2]'4', a[3]s3. The main program that calls the subroutine is shown below. Ascli('A')-0x41, ascll('O')-0x30. RESET: stopWDT: mov Initialize stack pointer Stop watchdog timer mov.w STACK END,SP DTPWWDTHOLD, &HDTCTL ; Main code here Sub. #4. SP mov.w SP, R14 mov.w myl, R4 push.w R14 call #12a s add .w #2, SP : allocate soace for ascii c ; 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 lend: .word x34AE ; Stack Pointer definition .sect .stack Interrupt Vectors .sect".reset" .short RESET MSP430 RESET Vector 4. (25 points) Write a subroutine Design and write an MSP430 assembly language subroutine 12a_s(char *a, int myl) that converts a 16-bit integer, myi, into a character array with eiements corresponding to the hexadecimal representation of the integer. For example, an integer my 13,486-0x34AE is converted into an array with 4 elements as follows: alol-E', a[1] 'A', a[2]'4', a[3]s3. The main program that calls the subroutine is shown below. Ascli('A')-0x41, ascll('O')-0x30. RESET: stopWDT: mov Initialize stack pointer Stop watchdog timer mov.w STACK END,SP DTPWWDTHOLD, &HDTCTL ; Main code here Sub. #4. SP mov.w SP, R14 mov.w myl, R4 push.w R14 call #12a s add .w #2, SP : allocate soace for ascii c ; 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 lend: .word x34AE ; Stack Pointer definition .sect .stack Interrupt Vectors .sect".reset" .short RESET MSP430 RESET Vector

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions