Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am having an issue with this practice problem. I understand the concept of given step, but I am lost to figure out how to

I am having an issue with this practice problem. I understand the concept of given step, but I am lost to figure out how to setup in the main program in CodeWarrior software. Using the HCS12 Microcontrollers and Embedded Systems, 1st Edition, I was able to understand the instruction appendix, but I was not able to construct it in the main program. I need help to solve these steps and it is due today.

image text in transcribed

image text in transcribed

Modify the Main program section of the main.asm as follows:

1. After instruction: JSR InitLEDs, but, before the loop, write code to load number $1100 to X.

2. Inside the loop, after loading A from PTH, write code to add number $05 to A.

3. Then, store the sum to memory location $1100 using X indexed addressing mode.

4. After the code STAA PORTB, write code to load number $03 to B.

5. Then, write code to do A B.

6. Store the subtraction result to memory location $1101 using X indexed addressing mode.

7. Then, send this result to POTRB.

8. Now, load B from PTH.

9. Load the subtraction result from step f) using X indexed addressing mode to A.

10. Do A multiply by B.

11. Save the product to memory location $1102 and $1103 using extended addressing mode.

12. Send the low byte of the product to PORTB.

13. Branch to BACK

File Name Date Purpose Procedure Test export symbols For absolute assembly: this is the application entry point ABSENTRY Main Include derivative-specific definitions The microcontroller chip used by Dragon12-plus2 board INCLUDE mc9s12dg256.inc Symbolic constant (EQU) section DATA STACK CODE EQU EQU EQU RAMStart RAMEnd+1 $4000 use $1000 -$1FFF for data use $2000 -$3FFF for staclk use flash ROM $4000 - $7FFF for code Data section ORG DATA Main program section ORG CODE Main LDS JSR JSR #STACK InitSwitches InitLEDs Get data from DIP swithces via.PTH and send it to LEDS via.PORTE BACK LDS STAA BRA PTH PORTB BACK get data from DIP Switches ands send 1t to LEDS Subroutine: Init Switches InitSwitches DIP switches are connected to PTH on Dragon 12-Light LDAA #$0 STAADDRH make PTH as Input port RTS Subroutine: Init LEDS

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

Hands-On Database

Authors: Steve Conger

2nd Edition

0133024415, 978-0133024418

More Books

Students also viewed these Databases questions

Question

Describe how to train managers to coach employees. page 422

Answered: 1 week ago