Exp 3 Systick Timer Led and Switch

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Embedded Systems Lab

Experiment 3: SysTick Timer with LED and Switch

Objective: This experiment comprises of creating specific time delay with help of SysTick timer
and blink LED with specific time delay.
Components: Tiva Launchpad, LEDs, 470 ohm resistor, wires.
Note: Please use the project file provided along with this document.
SysTick Timer:
It provides a simple, 24-bit clear-on-write, decrementing, wrap-on-zero counter with a flexible
control mechanism.
The timer consists of three registers:
■ SysTick Control and Status (STCTRL): A control and status counter to configure its clock,
enable the counter, enable the SysTick interrupt, and determine counter status.
■ SysTick Reload Value (STRELOAD): The reload value for the counter, used to provide the
counter's wrap value.
■ SysTick Current Value (STCURRENT): The current value of the counter.
Refer datasheet for register description.
The experiments will be using 80MHz clock source. The formula to calculate reload value is:
Reload value=(desired time)/(12.5ns)
Each count takes (1/80*10^6)s time.

Exercise 1: Using Systick timer, generate a square wave of 500us on PA6 and observe in
debugger. You can connect GPIO pin to ear phone to listen tuning fork sound.(Using Interrupt
method)
Exercise 2: Using Systick timer, provide a delay of 10ms to blink the on board Red LED and
LED at PA5. (Using Counter method)
Post Lab exercise:
Design a traffic light controller for the following situation

For West Road:


 Red signal should last for 5s
 Time delay between red and yellow should be 0.2s
 Yellow signal should last for 1s.
 Green signal duration should be 6.5s

For South Road:


 Red signal should last for 6.5s
 Time delay between red and yellow should be 0.1s
 Yellow signal should last for 2s.
 Green signal duration should be 5s

You might also like