Question: Task 3 ? Use the delay assembly code from class ( Execution Time ) to generate a delay of 0 . 5 second. Note that

Task 3?
Use the delay assembly code from class (Execution Time) to generate a delay of 0.5 second. Note
that you may need to use a loop inside a loop to achieve the total delay. Then download the C code we
used in Lab 1. Using inline assembly, insert the delay sequence of instructions using asm {} in the main
function where the MSdelay (500) function is called, i.e. replace the MSdelay(500); line with the inline
assembly sequence. Note that you will not implement a function for the delay in this lab. Compile and
download this to the board and confirm that the LEDs blink on and off correctly.
Note that you may not be able to create the exact same delay in cycles, you want to be as close as
possible.
Entering inline assembly works like the following example. Use the "asm" keyword and include your
code between {} brackets.
asm
{ addd #1
addd #10
}
Answer the following questions:
1- How many cycles you will need to create a delay of 0.5 seconds?
2- How many iterations do you need to execute the loop on slide 5 to have a 0.5-second delay?
3- Does the answer for 2 fit in one HCS12 register? If not, what do you need to do to overcome
the problem?
4- Were you able to get the exact same cycles in delay? Why or why not?
5- What is the total delay time that you were able to create?
 Task 3? Use the delay assembly code from class (Execution Time)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!