Starting from:
$30

$24

Lab 6. Generating Precise Delays Using SysTick, PLL , and Periodic Interrupts © Solution

Preparation

You will need a LaunchPad and a laptop/computer with Keil uVision5 installed. Download the Lab6 starter project from Canvas.

Starter project    Lab6

Purpose

The purpose of this lab is for you to become familiar with using SysTick to create precise delays and using the PLL to change the clock speed.

Introduction

The SysTick timer built into the Tiva board allows you to make precise time measurements by counting the number of clock ticks. The PLL allows you to change the speed of the clock on the board. For this lab, you will use a combination of these subsystems to generate delays.

You have been initially provided with initializations for PortF to enable the LEDs and pushbuttons. In main.c there is a macro called LAB_PART which is used to select which section of the lab you are doing.
You must change its valueeach time you move on to a new part.

Procedure

    1. Finish the initialization function for SysTick. Using the SysTick timer, complete the 1ms delay function SysTick_Delay1ms_16MHz() and then use that function to complete the longer 2 second delay function SysTick_Delay2s_16MHz(). If done correctly, the blue LED should toggle every two seconds. The LED will only toggle while at least one of the pushbuttons is being held down. Show your code to the TA.

Signature_______________________________    Date_________


    2. Now configure the PLL to increase the clock speed to 50 MHz and then repeat the same process as in Part 1. You should only need to modify the value of SYSDIV2 to set the clock speed. The functions you need to complete are SysTick_Delay1ms_50MHz() and SysTick_Delay2s_50MHz(). If done correctly, the red LED should toggle every two seconds. The LED will only toggle while at least one of the pushbuttons is being held down. Show your code to the TA and explain what you had to do differently than you did in Part 1.

Signature_______________________________    Date_________



    3. Now you will generate delays using period SysTick interrupts. You need to complete
SysTick_Init_Interrupts() so that interrupts are generated every 20ms. Complete the SysTick Handler so that the Green LED is toggled every 2 seconds and the Blue LED is toggled every 1 second. You should not change the rate of the interrupts. Note that interrupts will not begin until you press one of the pushbuttons. Show your code to the TA.

Signature_______________________________    Date_________




1
EE/CPE 287 Lab 6

More products