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.
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
I am having an issue with this practice problem. I understand the concept of given step,...
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 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 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 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...