Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create an assembly project with the sample program, and debug using MPSIM. /********************************************************************* * FileName: Lab2.S * * Processor: PIC32MX * * Assembler/Compiler/Linker: MPLAB C32
Create an assembly project with the sample program, and debug using MPSIM.
/********************************************************************* * FileName: Lab2.S * * Processor: PIC32MX * * Assembler/Compiler/Linker: MPLAB C32 / MPLAB XC32 * ********************************************************************* * * Description: * This project demonstrates how to build projects with only * assembly language source files. * * This example uses "S" extension so that the 'C' pre-processor * can be used. * * This example provides simple assembly application. It uses * standard C Startup code provided by the C32 compiler. * * This code was modified from a version * "ports_control_assembly_example" found in a collection of code * examples on microchip.com. * ********************************************************************/ #include/* define all global symbols here */ .global main /* define which section (for example "text") * does this portion of code resides in. Typically, * all your code will reside in .text section as * shown below. */ .text /********************************************************************* * main() * This is where the PIC32 start-up code will jump to after initial * set-up. ********************************************************************/ .ent main /* directive that marks symbol 'main' as function in ELF * output */ main: /* while() * { * a2=2 * a1=10 * while (a1!=0) * { * a1=a1-1; * a2=2*a2; * } * } */ endless: addi a2,zero,2 addi a1,zero,10 L1: addi a1,a1,-1 add a2,a2,a2 bne a1,zero,L1 j endless .end main /* directive that marks end of 'main' function and registers * size in ELF output */
Coding WORK 1) Create a project to find the sum of the numbers from 14 to 35 and store it in the a2 register. Sum = ) n=14 Coding WORK 1) Create a project to find the sum of the numbers from 14 to 35 and store it in the a2 register. Sum = ) n=14
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started