You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
2.0 KiB
32 lines
2.0 KiB
//#############################################################################################################################################################################################################
|
|
#include "SYSTEMCustom.h"
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
void System_InitSysTick(void)
|
|
{
|
|
SystemSystickCounter=0;
|
|
TCNT0=0xFF-250; // 1 ms
|
|
TCCR0B=0; // no clock
|
|
TIMSK0=0; // Overflow Interrupt Disable
|
|
}
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
ISR(TIMER0_OVF_vect) // 1ms timer0 interrupt
|
|
{
|
|
TCNT0=0xFF-250; // 1 ms
|
|
if (SystemSystickCounter==0xFFFFFFFF) SystemSystickCounter=0; else SystemSystickCounter++;
|
|
}
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
void System_SystickTimerStart(void)
|
|
{
|
|
SystemSystickCounter=0;
|
|
TCNT0=0xFF-250; // 1 ms
|
|
TCCR0B=3; // clkI/O/64 (from prescaller)
|
|
TIMSK0=1<<TOIE0; // Overflow Interrupt Enable
|
|
}
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
void System_SystickTimerStop(void)
|
|
{
|
|
TCCR0B=0; // no clock
|
|
TIMSK0=0; // Overflow Interrupt Disable
|
|
}
|
|
//-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
//#############################################################################################################################################################################################################
|