Systick Interrupt Code
This commit is contained in:
parent
211c555186
commit
169e06990e
|
@ -5,22 +5,33 @@
|
|||
* main.c
|
||||
*/
|
||||
|
||||
|
||||
void GPIO_PORTF_Init(void);
|
||||
void SystickHandler(void);
|
||||
|
||||
volatile uint32_t systick_count = 1;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
NVIC_ST_RELOAD_R = 0x10;
|
||||
GPIO_PORTF_Init();
|
||||
NVIC_ST_RELOAD_R = 0x9C4;
|
||||
NVIC_ST_CURRENT_R = 0x0;
|
||||
//Enable Systick:
|
||||
// SYST_CSR = 0x00000101 -- 0x5
|
||||
NVIC_ST_CTRL_R = 0x5;
|
||||
|
||||
// SYST_CSR = 0x00000111 -- 0x7
|
||||
NVIC_ST_CTRL_R = 0x7;
|
||||
while(1);
|
||||
|
||||
}
|
||||
|
||||
void SystickHandler(void)
|
||||
{
|
||||
systick_count++;
|
||||
if(systick_count==1000)
|
||||
{
|
||||
systick_count = 0;
|
||||
GPIO_PORTF_DATA_R ^= 0x2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GPIO_PORTF_Init(void)
|
||||
|
|
|
@ -33,6 +33,8 @@ void ResetISR(void);
|
|||
static void NmiSR(void);
|
||||
static void FaultISR(void);
|
||||
static void IntDefaultHandler(void);
|
||||
void SystickHandler(void);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
|
@ -82,7 +84,7 @@ void (* const g_pfnVectors[])(void) =
|
|||
IntDefaultHandler, // Debug monitor handler
|
||||
0, // Reserved
|
||||
IntDefaultHandler, // The PendSV handler
|
||||
IntDefaultHandler, // The SysTick handler
|
||||
SystickHandler, // The SysTick handler
|
||||
IntDefaultHandler, // GPIO Port A
|
||||
IntDefaultHandler, // GPIO Port B
|
||||
IntDefaultHandler, // GPIO Port C
|
||||
|
|
Loading…
Reference in New Issue