当前位置:天才代写 > CS代写,CS作业代写考试代考-价格便宜有靠谱 > 微控制器导论代写 Microcontrollers代写

微控制器导论代写 Microcontrollers代写

2021-12-03 14:47 星期五 所属: CS代写,CS作业代写考试代考-价格便宜有靠谱 浏览:445

微控制器导论代写

ECE2560 Introduction to Microcontrollers

 Final 

微控制器导论代写 In PART A you write small code snippets and answer questions. There is no need to create a CCS project for this part. However, you may want to

This exam consists of PART A (30 points) and PART B (70 Points).

In PART A you write small code snippets and answer questions. There is no need to create a CCS project for this part. However, you may want to create a project for yourself to check out your answers.

PART B is a complete CCS project.

In this document, PART A is presented first along with instructions for PART A. After that the problem statement for PART B is presented along with instructions.

 

PART A (30 Points)  微控制器导论代写

Each problem in PART A is worth 5 points.  You can submit PART A of the exam in the following two ways:

i) Print PART A, complete PART A using an ordinary pen or a pencil, and then scan all the pages of PART A (or take good quality pictures)

ii) If you have a stylus and a pad (or something similar like an iPad) then you can directly write on this pdf.

You may attach more pages if the provided space for solutions is not enough. Include this document in pdf format with your submission.

Prob. 1: Given:

     .data
x:  .word  23
y:  .word  ‐3

Write lines of assembly code for the following pseudocode   (use alternate implementation of the if statement). Use register R5 if temporary storage is needed):

if(x <= 4)
{
  y = 0;
}
else
{
  y=1;
}

 

Prob. 2: Given:

     .data
x:  .word  23
y:  .word  ‐3

Write lines of assembly code for the following pseudocode:

if( the 4th bit of x is set )
{
  y = 0;
}

Note: The least significant bit is the 0th bit.

 

Prob. 3:  微控制器导论代写

Write lines of assembly code to configure pin P8.5 for digital output

Prob. 4: Write lines of assembly code to configure pin P8.5 for digital input, no resistor and interrupt on rising edge

Prob. 5: A subroutine named MySub takes three inputs (words) and returns one output (word). All inputs and outputs are handled via the stack. Write lines of main code to call this subroutine with inputs of 8, 5 and ‐2. Your calling code should store the value of the output in the core register R5. Make sure that the main code cleans up the stack properly.  (Note: Push 8 on the stack first, then 5 and then ‐2)

Prob. 6: Regarding problem 5 above, fill out the stack picture given below, i.e., put the value of data sitting at these stack locations,  once the subroutine has just started to execute.

Besides data values, you may also use the terms “return address”, “junk” or “output will go here”, as appropriate, to fill in these blanks.

0(SP) _________________

2(SP) _________________

6(SP) _________________

8(SP) _________________

10(SP) _________________

 

 

PART B (70 Points)  微控制器导论代写

Write a complete assembly language program to:

Configure push‐button S2 to accept interrupts. Note that push‐button S2 is active low (puts a 0 on the pin when it is pressed, puts a 1 on the pin when it is not pressed). Write a program which listens to this interrupt and counts the number of  times the switch has been pressed. Put this number in a variable names sum (.data region). The MCU should enter Low Power Mode  (LPM3) while it is waiting for interrupts to happen. Note that when you start your program in the debugger, initially a one‐time spurious interrupt will be registered on the S2 pin, therefore, your sum will be off by a count of one; don’t worry about this.

Here is how to effectively work with this program to see if it is working as expected:

When you go in debug view, run the program, and while the program is running, press the S2 button a number of times. Then pause the program, and look in the memory browser to observe the value of the variable sum. Then unpause the program again and while it is running press S2 a few more times, then pause the program again and observe the value in the variable sum. The value you see in sum should be the total number of S2 presses you have made (this value could be one more than the number of presses).

  • Use Interrupts to handle button presses
  • Use lowering edge interrupts to handle interrupts caused by buttonpresses
  • The MCU should enter Low Power Mode  (LPM3) while it is waiting for interrupts to happen.
  • Use only one interrupt service routine
  • Screencasts 20, 21, 22, 23 are particularly relevant for this problem

 

微控制器导论代写
微控制器导论代写

 

Note1:

On Page 3 of  Lessson20,

P1IFG0 means 0th bit of the P1IFG register

P1IFG1 means 1st bit of the P1IFG register. etc.

Note2: Since you are dealing with multi sourced interrupts, include the following instruction at the end of your Interrupt Service Routine:

clr.b    &P1IFG

Do not use something like: bic.b    #BIT1,  &P1IFG. This won’t work

Instructions: Use the word template and instructions contained on our web site to submit your screenshots to Carmen. Do not email directly to your TA or me. Files emailed to the TA or me will not be accepted. Include the following in your submission:

i) Assembly language source code (Word format) of the main program and the Interrupt Service Routine. Make sure to attach every line of the source code, with nothing missing. Don’t forget to include the last part of your program where the interrupt vectors are handled.

ii) Screenshot of the “General” tab of the properties screen of your project.

 

微控制器导论代写
微控制器导论代写

 

 

 

 

更多代写:美国PYTHON代写  一般统计网课代考  英国医学Medicine代写  英语Essay代写学术文章  学期陈述代写  纳什维尔州立社区学院代写

合作平台:随笔代写 论文代写 写手招聘 英国留学生代写

 

 

 

天才代写-代写联系方式