2024-10-28 23:34:31 +05:30
|
|
|
#include <stdint.h>
|
|
|
|
#include "tm4c123gh6pm.h"
|
2024-10-28 23:36:10 +05:30
|
|
|
|
|
|
|
#define STCTRL *((volatile uint32_t *) 0xE000E010) // Control and status
|
|
|
|
#define STRELOAD *((volatile uint32_t *) 0xE000E014) // Reload value
|
|
|
|
#define STCURRENT *((volatile uint32_t *) 0xE000E018) // Current value
|
|
|
|
|
|
|
|
#define ENABLE (1 << 0) // Bit 0 of CSR to enable the timer
|
|
|
|
#define CLKINT (1 << 2) // Bit 2 of CSR to specify CPU clock
|
|
|
|
#define CLOCK_HZ 16000000 // Clock frequency of EK-TM4C123GXL
|
|
|
|
#define SYSTICK_RELOAD_VALUE(us) ((CLOCK_HZ / 1000000) * (us) - 1) // SysTick reload value in microseconds based on clock frequency
|
2024-10-28 23:38:37 +05:30
|
|
|
|
|
|
|
void systick_setting(void)
|
|
|
|
{
|
|
|
|
STRELOAD = SYSTICK_RELOAD_VALUE(1000); // RELOAD VALUE FOR 1ms
|
|
|
|
STCTRL |= ENABLE | CLKINT; // Enable SysTick with system clock
|
|
|
|
STCURRENT = 0; // Clear current value
|
|
|
|
}
|