Presentation is loading. Please wait.

Presentation is loading. Please wait.

Refer to Chapter 3 in the reference book

Similar presentations


Presentation on theme: "Refer to Chapter 3 in the reference book"— Presentation transcript:

1 Refer to Chapter 3 in the reference book
The Cortex-M3/M4 Embedded Systems: TM4C1294NCPDT Microcontroller – SysTick Refer to Chapter 3 in the reference book “Tiva™ TM4C1294NCPDT Microcontroller- DATA SHEET”

2 SysTick: System Timer Provides a simple, 24-bit clear-on-write, decrementing, wrap-on-zero counter An RTOS tick timer which fires at a programmable rate (for example, 100 Hz) and invokes a SysTick handler routine A high-speed alarm timer using the system clock A variable rate alarm with other reference clock A simple counter used to measure time to completion and time used

3 Functional Description
SysTick consists of three registers: SysTick Control and Status Register: a control and status counter to configure its clock, enable the counter, enable the SysTick interrupt, and determine counter status SysTick Reload Value Register: the reload value for the counter, used to provide the counter's wrap value SysTick Current Value Register: the current value of the counter Note: the SysTick Calibration Value Register, is not implemented

4 Functional Description
When enabled: SysTick operates in a multi-shot way: reloads the Reload value from the SysTick Reload Value register and counts down on each clock to zero When counting from 1 to 0: the COUNT status bit in SYSTICK Control and Status Register is set (clear on reads) An interrupt is generated if enabled by the INTEN bit in SYSTICK Control and Status Register Reloads (wraps) the Reload value on the next clock edge During counting down: Clearing the SysTick Reload Value register disables the counter on the next wrap Get the current count by reading the SysTick Current Value register Writing to the SysTick Current Value register clears the register and the COUNT status bit If the core is in debug state (halted), the counter does not decrement

5 SysTick Control and Status Register, 0xE000E010

6 SysTick Reload Value Register, 0xE000E014
The initial count N can be between 1 and 0x00FF.FFFF SysTick fires on every N+1 clock. For example, if a tick interrupt is required every 100 clock pulses, 99 must be written into the RELOAD field When reading this register, the system clock must be faster than 8MHz

7 SysTick Current Value Register, 0xE000E018
The SysTick Current Value Register contains the current value of the counter.

8 Initialization and Configuration
Write the appropriate initial count to the SysTick Reload Value Register Configure the SysTick timer by programming the SysTick Control and Status Register Set ENABLE and CLK_SRC (if use system clock) as 1 If you are using interrupts: Set INTEN as 1 Write the corresponding handler for SysTick exceptions Otherwise, you are using software pulling: Set INTEN as 0 To check whether there is a tick: polling the COUNT status and process accordingly when the value is 1 To measure a time duration: read the SysTick Current Value Register when job is done and calculate the passed time

9 SysTick Programming with PDL (1)
Software pulling ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_16MHZ |SYSCTL_OSC_INT |SYSCTL_USE_OSC), ); SysTickPeriodSet(ui32SysClock/1000);//the tick duration is 1mS SysTickEnable(); //enable the SysTick ui32Value = SysTickValueGet(); //read the current count of SysTick

10 SysTick Programming with PDL (2)
Interrupt driven ui32SysClock = SysCtlClockFreqSet((SYSCTL_XTAL_16MHZ |SYSCTL_OSC_INT |SYSCTL_USE_OSC), ); SysTickPeriodSet(ui32SysClock/1000); );//The tick duration is 1mS SysTickEnable(); //Enable the SysTick SysTickIntEnable(); //Enable SysTick exceptions IntMasterEnable(); //Enables the processor interrupt void SysTick_Handler(void) //SysTick handler


Download ppt "Refer to Chapter 3 in the reference book"

Similar presentations


Ads by Google