How to Read Yes and No Input in Mips
Description
lab5manual.pdf I need help with my lab projection. I spent significant time on that simply since I am abs new to this program and its software/hardware i am nevertheless in demand of major help.
my first question is in debugging that what does it hateful when it says: How many levels deep is the call and how to nosotros trace executible stack in printf here? how to we find depth level of phone call in stack?!!!
later this i need assist towrite your own function that will return a constant 0x80000 for the
delay loop in the demo.c program that i attached here to this teaching and impress out the number of times that it has been called tothe serial output. The output should await exactly similar:
Hello, earth! 0
Hello, world! 1
after that I need help how to "tune" the filibuster values using the input switches. Outset, read the state
of all 4 switches and encode the boolean values from the switches into the lower iv-bits
of a single word.
I attached a pdf file of detailed instruction of what is this lab about i wanted besides adhere demo.c file which is the c plan for this lab yous do not demand to write C i already requite you lot the c you need to write assembly in MIPS.If needed I take tutorial pdf also so it gives you more idea hot to start simply since it only allow me to attach i pdf file i attached manual lab so you know whats upwards and if you know most this allow me know and sick send you more than file alonge with demo.c (cprogram) I def need help with what I asked and if not fully helped at least I need help how to start and practise it. please assistance me. for this lab you should take :
This lab assumes that yous have:
• MPLABX IDE v2.fifteen (newer versions require a PICKit3 firmware upgrade!)
http://ww1.microchip.com/downloads/en/DeviceDoc/MPLABX-v2.xv-windows-installer.
cipher
http://ww1.microchip.com/downloads/en/DeviceDoc/MPLABX-v2.xv-osx-installer.dmg
• MPLAB x32 cross-compiler v1.33
http://www.microchip.com/pagehandler/en_us/devtools/mplabxc/
*CoolTerm
Unformatted Zipper Preview
CMPE 12L Lab 5 - Fall 2014 PIC32 Function Calls and IO Prof. Matthew Guthaus Due: November 26, 2014 5pm 75 Points (20 Report, 55 Piece of work) ane Background Interfacing with the outside earth requires that the processor understand time in human terms. However, instructions run much faster than we can see. In fact, the clock frequency very roughly specifies the number of instructions that run per second. Our processor has an fourscore MHz clock speed, at that place are 80,000,000 cycles per 2d. This is an approximation, nevertheless, because some instructions take more than than one cycle to run if, for example, they access a slow memory. In this assignment, nosotros are going to write a role in assembler to read the state of some input switches and control the rate of the LEDs blinking. 2 Prerequisites This lab has a lot of reading, because this is also the reading for lecture. The PIC32 textile is not in the textbook so you do not have whatsoever textbook readings for the side by side couple weeks. • • • • • • 3 Read through this entire lab assignment. Review the lecture notes on the PIC32 architecture. Read section 4.0 of PIC32MX320F128.pdf in eCommons Read section 12.0 of PIC32MX320F128.pdf in eCommons Expect at section 27.0 of PIC32MX320F128.pdf in eCommons Sections i.0-3.0 of PIC32MX320F128.pdf are besides interesting, but non required reading. Tutor/TA Review Your lab tutor/TA volition comprehend the post-obit items in the starting time portion of the showtime lab: • How to employ the MPLAB X • How to use the Arduino, IO module, and debugger/programmer. • What'south required i 4 Assignment This assignment has 4 parts. You should finish offset part 1 (and possibly function 2) quite quickly, only the other three parts may take significant time. Role iii requires writing your first MIPS assembly role. Part iv requires learning about the PIC32/Uno32 hardware to receive input from the switches. 4.ane Part one: Tutorial Read through and experiment with the options in the unabridged tutorial. Run the demo.c programme and answer some of the initial questions at the end. Y'all exercise not need to show this to your TA or tutor, just information technology is required to practise the other parts. 4.2 Office 2: Debugging In this section, you are to trace the execution stack of the printf statement in the demo program. Specifically, what addresses and labels does it jump to in society to print the output. Trace through the execution and observe what happens. Annotation that these are in a C library routine which you lot tin can see in the Window→Motion picture Memory Views→Execution Retention. By looking at the Window→PIC Retentivity Views→CPU Registers, yous can run into what addresses and return addresses are used in the jal and jr instructions. How many levels deep is the telephone call? What functions/labels and at what addresses? Can y'all figure out how many and what arguments are passed to phone call? four.3 Role 3: Subroutines in MIPS In this department, you are to write your own function that volition render a abiding 0x80000 for the delay loop in the demo.c program and print out the number of times that information technology has been called to the series output. The output should await exactly like: Howdy, world! 0 Hullo, globe! 1 Hello, world! 2 ... You may miss a few of the initial ones by the time you lot attach the terminal program. That is ok! In order to successfully do this, you need to properly implement the caller and callee salve register schemes on the stack. Do not save registers to local memory. Employ the stack. What registers did you save and why? Where practise y'all store the number of times that the function has been called? four.4 Part 4: I/O in MIPS In this department, y'all should "tune" the delay values using the input switches. First, read the state of all 4 switches and encode the boolean values from the switches into the lower four-$.25 of a single give-and-take. This can be stored in a register or retentivity if you like. 2 Now that nosotros have the switch value, we desire to bike through all 8 LEDs at approximately the post-obit rates: SW4 SW3 SW2 SW1 Description 0 0 0 0 0 seconds (constantly moving, no delay) 0 0 0 1 1 second ... ane 0 0 0 8 seconds (one LED moving every 1 second) ... ane 1 1 1 15 seconds (i LED moving roughly every ii seconds) These don't accept to be exact, but they should be close enough to convince your TA/tutor. The bodily values should be interpolated (or extrapolated) using arithmetic operations (e.g. ADD, MULT, MULTSUB and DIV). You can create your own multiple and divide if y'all want, merely it is probably easier to utilise the hardware instructions. Remember, interpolation/extrapolation is simply using two values to create a linear fit and estimating the other points based on this line. Rather than approximate what the return values should be to get an advisable delay, can yous compute two points (say 1 and 15) and guess using the 80MHz CPU clock? What is the delay per iteration of the for loop in the C programme? How practise you implement the correct render values? 5 Input/Output You are given C lawmaking that light the LEDs. In addition to looking at the C, you can look at the disassembled output to run into the exact instructions to exercise this. This is a useful identify to offset for implementing your device input from the switches. For part iv, you demand to read the values from the switches during each call to your getDelay function. Input/output in our microcontroller is based on device registers mapped to certain addresses. Specifically, the switches accept different names on the Uno32 lath, PIC32 packet, and in the CPU Ports. The following is from the Bones I/O board and Uno32 reference transmission: Name Uno32 Pin PIC32 Pin Port/Bit SW1 2 42 RD8 SW2 7 43 RD9 SW3 eight 44 RD10 SW4 35 45 RD11 This means these are all on Port D. As an case, the port D address starts at 0xBF88 60C0 and is shown in Tabular array 4-26 of PIC32MX320F128.pdf. At that place are 4 registers that permit us configure the input/output: TRISD (0xBF88 60C0), PORTD (0xBF88 60D0), LATD (0xBF88 60E0), and ODCD (0xBF88 60F0) which are described in Section 12 of the PIC32 reference transmission. The document describes all the ports as TRISx where ten can exist A to Yard for each of the IO ports (A to G) at different addresses. Each of the to a higher place registers actually has four addresses that perform dissimilar functions. The base register can be read or written to change all of the bits at in one case. Three additional registers are used to change one flake at a fourth dimension: clear (offset 4), ready (commencement 8), and capsize (outset 12). The ones in a mask specify which bits to clear, set or invert. And so, for example, if you want to set fleck 0 of the TRISD annals, you tin can write a binary mask of 0x1 to address 0xBF88 60C8 (0xBF88 60C0 + 8). 3 The TRISD register controls whether a pin is an input or output. Setting a scrap to a 0 (active depression) means that it will be an output. Setting it to a i makes it an input and is the default afterward power on. The PORTD register is where you lot tin can read or write data. Similarly, LATF can read or write data just this is synchronized to the system clock in a latch. Writing the LATF as an output will concord the value later on the current clock cycle. Is at that place a difference between writing LATF and PORTF? Last, ODCD controls whether the output is a CMOS logic voltage or is an "open bleed" connection. Yous will larn more than about this in other classes, only we don't demand it here. The full schematic of the I/O port is shown in Figure 12-one of the PIC32 manual. 6 Format Your program must be two text files: the demo.c file with the function call to getDelay and the assembly code that assembles with no errors and implements getDelay. vii Lab Submission Your lab will be submitted via your eCommons account. Please log in to eCommons using your UCSC account and attach the following files to your "Lab 5" assignment submission: • demo.c which contains the function call (slightly modified to practice this) • lab5.south which contains the subroutine call with variable delay and the printf of each call number • lab5 report.pdf Note that the concluding report must exist submitted in PDF format. Make certain to confirm that your consignment is SAVED and SUBMITTED before the deadline. You may resubmit your assignment an unlimited number of times up until the due date. 7.1 Check-off For this lab, as with most labs, you will demand to demonstrate your lab when it is finished to the TA or tutor and get information technology signed off. Yous will also need to submit your lab files using eCommons. Any demos afterward the submission deadline require the files to be downloaded from eCommons. 7.2 Grading template This is a suggested grading rubric. It is too a good general guideline before submitting your lab to bank check off these points. 4 seven.ii.1 Requirements (25 pts) Part 3 – Does the program render from the function properly to the main C program? – Did yous properly relieve/restore caller/callee salvage variables to the stack? – Does your office properly print the text? – Does your function properly print the current iteration count? – Does your delay return value work then that the LED delay is the same as the original demo.c? (xxx pts) Part 4 – Does a filibuster of 0 work? – Does a delay of 8 work (ane 2nd per LED)? – Does a delay of 15 piece of work (simply under 2 seconds per LED)? – Does the programme correctly interpolate/extrapolate? 7.ii.ii Lab write-up requirements In the lab write-upward, we volition be looking for the following things. The lab written report is worth xx points. We do not break down the point values; instead, we will assess the lab report equally a whole while looking for the following content in the report. Along with the usual items, you should respond the post-obit questions: • Is "li $t0, 0xBF886110" an instruction or a pseudo-operation in the assembler? Explicate. • What instructions does the "mask = mask
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
This question has not been answered.
Create a gratis account to become assistance with this and any other question!
Source: https://www.studypool.com/discuss/292390/pic32-function-calls-and-io-debugging-subroutines-in-mips-i-o-in-mips-input-ou
0 Response to "How to Read Yes and No Input in Mips"
Post a Comment