Question

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.

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

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

0 0
Add a comment Improve this question Transcribed image text
Know the answer?
Add Answer to:
I am having an issue with this practice problem. I understand the concept of given step,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Can anyone explain this code? I get the gist of it, but having someone explain this...

    Can anyone explain this code? I get the gist of it, but having someone explain this code would be helpful ;***************************************************************** ;   Data section    ;*****************************************************************    ORG DATA   ;***************************************************************** ;    Main program section    ;*****************************************************************    ORG CODE   Main: LDS #STACK LDAA #%00000100 STAA DDRT    LDAA #$80 STAA TSCR1 LDAA #$07 STAA TSCR2 BSET TIOS, %00000100 LDAA #$10 STAA TCTL2 CLI LDAA #$04 STAA TIE       Here NOP BRA Here ;***************************************************************** ;    Subroutine section ;*****************************************************************...

  • I am writing a program in c programming and it is supposed to do the following using mc9s12dg256.h microcontroller When...

    I am writing a program in c programming and it is supposed to do the following using mc9s12dg256.h microcontroller When both DIP switches #8 and #1 are high, turn on all LEDS. When both DIP switches #8 and #1 are low, turn off all LEDs When DIP switch #8 is high and #1 is low, turn on all the even numbered LEDs. When DIP switch #1 is high and #8 is low, turn on all the odd numbered LEDs. Your...

  • Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how...

    Subroutines in MIPS Determines the minimum of two integers Functions within the MIPS slides describe how one can use subroutines (also called procedures, functions, and methods) in MIPS. Because of the importance of subroutines in modern programming, most hardware designers include mechanisms to help programmers. In a high-level language like C or Java, most of the details of subroutine calling are hidden from the programmer. MIPS has special registers to send information to and from a subroutine. The registers $a0,...

  • I am having problems with the following assignment. It is done in the c language. The...

    I am having problems with the following assignment. It is done in the c language. The code is not reading the a.txt file. The instructions are in the picture below and so is my code. It should read the a.txt file and print. The red car hit the blue car and name how many times those words appeared. Can i please get some help. Thank you. MY CODE: #include <stdio.h> #include <stdlib.h> #include <string.h> struct node { char *str; int...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT