Fix timer interrupt
This commit is contained in:
parent
c1fbbce805
commit
c50632c1bf
@ -2,13 +2,6 @@
|
|||||||
|
|
||||||
#include <arch/time.h>
|
#include <arch/time.h>
|
||||||
|
|
||||||
void external_0(void) __interrupt(0) {}
|
|
||||||
// timer_0 is in time.c
|
|
||||||
void external_1(void) __interrupt(2) {}
|
|
||||||
void timer_1(void) __interrupt(3) {}
|
|
||||||
void serial(void) __interrupt(4) {}
|
|
||||||
void timer_2(void) __interrupt(5) {}
|
|
||||||
|
|
||||||
void arch_init(void) {
|
void arch_init(void) {
|
||||||
// Disable interrupts
|
// Disable interrupts
|
||||||
EA = 0;
|
EA = 0;
|
||||||
|
@ -7,11 +7,12 @@
|
|||||||
static volatile uint32_t time_overflows = 0;
|
static volatile uint32_t time_overflows = 0;
|
||||||
|
|
||||||
void timer_0(void) __interrupt(1) {
|
void timer_0(void) __interrupt(1) {
|
||||||
|
// Stop timer
|
||||||
|
TR0 = 0;
|
||||||
|
|
||||||
time_overflows++;
|
time_overflows++;
|
||||||
|
|
||||||
// Restart timer
|
// Start timer
|
||||||
TR0 = 0;
|
|
||||||
TF0 = 0;
|
|
||||||
TH0 = 0xFD;
|
TH0 = 0xFD;
|
||||||
TL0 = 0x01;
|
TL0 = 0x01;
|
||||||
TR0 = 1;
|
TR0 = 1;
|
||||||
|
@ -19,6 +19,15 @@
|
|||||||
#include <common/debug.h>
|
#include <common/debug.h>
|
||||||
#include <common/macro.h>
|
#include <common/macro.h>
|
||||||
|
|
||||||
|
|
||||||
|
void external_0(void) __interrupt(0) {}
|
||||||
|
// timer_0 is in time.c
|
||||||
|
void timer_0(void) __interrupt(1);
|
||||||
|
void external_1(void) __interrupt(2) {}
|
||||||
|
void timer_1(void) __interrupt(3) {}
|
||||||
|
void serial(void) __interrupt(4) {}
|
||||||
|
void timer_2(void) __interrupt(5) {}
|
||||||
|
|
||||||
uint8_t main_cycle = 0;
|
uint8_t main_cycle = 0;
|
||||||
|
|
||||||
void init(void) {
|
void init(void) {
|
||||||
|
@ -20,6 +20,15 @@
|
|||||||
#include <common/debug.h>
|
#include <common/debug.h>
|
||||||
#include <common/macro.h>
|
#include <common/macro.h>
|
||||||
|
|
||||||
|
|
||||||
|
void external_0(void) __interrupt(0) {}
|
||||||
|
// timer_0 is in time.c
|
||||||
|
void timer_0(void) __interrupt(1);
|
||||||
|
void external_1(void) __interrupt(2) {}
|
||||||
|
void timer_1(void) __interrupt(3) {}
|
||||||
|
void serial(void) __interrupt(4) {}
|
||||||
|
void timer_2(void) __interrupt(5) {}
|
||||||
|
|
||||||
uint8_t main_cycle = 0;
|
uint8_t main_cycle = 0;
|
||||||
|
|
||||||
void init(void) {
|
void init(void) {
|
||||||
|
@ -20,6 +20,15 @@
|
|||||||
#include <common/debug.h>
|
#include <common/debug.h>
|
||||||
#include <common/macro.h>
|
#include <common/macro.h>
|
||||||
|
|
||||||
|
|
||||||
|
void external_0(void) __interrupt(0) {}
|
||||||
|
// timer_0 is in time.c
|
||||||
|
void timer_0(void) __interrupt(1);
|
||||||
|
void external_1(void) __interrupt(2) {}
|
||||||
|
void timer_1(void) __interrupt(3) {}
|
||||||
|
void serial(void) __interrupt(4) {}
|
||||||
|
void timer_2(void) __interrupt(5) {}
|
||||||
|
|
||||||
uint8_t main_cycle = 0;
|
uint8_t main_cycle = 0;
|
||||||
|
|
||||||
void init(void) {
|
void init(void) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user