Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

;------------------------------------------------------------------------------- ; MSP430 Assembler Code Template for use with TI Code Composer Studio ; ; ;------------------------------------------------------------------------------- .cdecls C,LIST,msp430.h ; Include device header file ;------------------------------------------------------------------------------- .def

image text in transcribed

;------------------------------------------------------------------------------- ; MSP430 Assembler Code Template for use with TI Code Composer Studio ; ; ;------------------------------------------------------------------------------- .cdecls C,LIST,"msp430.h" ; Include device header file

;------------------------------------------------------------------------------- .def RESET ; Export program entry-point to ; make it known to linker.

;------------------------------------------------------------------------------- .text ; Assemble into program memory. .retain ; Override ELF conditional linking ; and retain current section. .retainrefs ; And retain any sections that have ; references to current section.

;------------------------------------------------------------------------------ RESET mov.w #__STACK_END,SP ; Initialize stackpointer StopWDT mov.w #WDTPW|WDTHOLD,&WDTCTL ; Stop watchdog timer

;------------------------------------------------------------------------------- ; Main loop here ;-------------------------------------------------------------------------------

;------------------------------------------------------------------------------- ; Stack Pointer definition ;------------------------------------------------------------------------------- .global __STACK_END .sect .stack ;------------------------------------------------------------------------------- ; Interrupt Vectors ;------------------------------------------------------------------------------- .sect ".reset" ; MSP430 RESET Vector .short RESET

The Fibonacci Sequence is a famous number sequence. Each element of the sequence, denoted Fn, is the sum of the preceding two numbers, starting from 0 and 1. That is: FF-1 F-2 wheren > 1. If we wish to calculate the sequence to F6 we obtain F4 2 +1 3, Write and execute an assembly language program that calculates the value of F12. The value of F12 144 in decimal. In hexadecimal, F12 is 0x0090 Solve the problem in the following way: Store Fo and F1 as constants at the start of Flash ROM Store the number n 12 the sequence should be calculated to as a symbolic constant. (Note 12 is in decimal, you will need to use hexadecimal in your code) * e Initialize the value of register 5 to the symbolic constant to be used as a count down . Decrease register 5 by 1, since the value of F1 is already known Copy the values of Fo and F1 into register 6 and register 7 respectively Start a loop o Copy the value of register 6 to register 8 o Add the value of register 7 to register 8 o Copy the value of register 7 to register 6 o Copy the value of register 8 to register 7 o Decrease the counter (register 5) by 1 o If the counter is 0 exit the loop o Go to the top of the loop When the loop exits, the value of registers 8 and 7 should be the value of F12 which is 0x0090 The Fibonacci Sequence is a famous number sequence. Each element of the sequence, denoted Fn, is the sum of the preceding two numbers, starting from 0 and 1. That is: FF-1 F-2 wheren > 1. If we wish to calculate the sequence to F6 we obtain F4 2 +1 3, Write and execute an assembly language program that calculates the value of F12. The value of F12 144 in decimal. In hexadecimal, F12 is 0x0090 Solve the problem in the following way: Store Fo and F1 as constants at the start of Flash ROM Store the number n 12 the sequence should be calculated to as a symbolic constant. (Note 12 is in decimal, you will need to use hexadecimal in your code) * e Initialize the value of register 5 to the symbolic constant to be used as a count down . Decrease register 5 by 1, since the value of F1 is already known Copy the values of Fo and F1 into register 6 and register 7 respectively Start a loop o Copy the value of register 6 to register 8 o Add the value of register 7 to register 8 o Copy the value of register 7 to register 6 o Copy the value of register 8 to register 7 o Decrease the counter (register 5) by 1 o If the counter is 0 exit the loop o Go to the top of the loop When the loop exits, the value of registers 8 and 7 should be the value of F12 which is 0x0090

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions