[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Timer Interrupt Problem on ATmega 103L
From: |
Rune Christensen |
Subject: |
RE: [avr-gcc-list] Timer Interrupt Problem on ATmega 103L |
Date: |
Thu, 27 May 2004 10:19:46 +0200 |
Hello
I think that the clock is okay but Andrew needs to check it.
I should be okay because when Andrew puts TCNT0 directly out to PORTB it
counts like it should be.
Please look at page 42 in
http://www.atmel.com/dyn/resources/prod_documents/Doc0945.pdf
about special care needed when running timer0 with a seperate crystal.
I use this code on a 8515 without any kind of problems:
(Remember this is running on the main clock not a seperate one)
/* time.h */
#define TIMERINI 256-72
#define TIMERCON 0x05
void inittime(void);
/* time.c */
#include<avr/io.h>
#include<avr/interrupt.h>
#include<avr/signal.h>
#include"../main.h"
#include"time.h"
volatile quad uptime;
SIGNAL(SIG_OVERFLOW0)
{
/* reinitialize timer */
TCNT0 = TIMERINI;
uptime++;
}
void inittime(void)
{
TCCR0 = TIMERCON;
TCNT0 = TIMERINI;
TIMSK |= 1<<TOIE0;
uptime = 0;
}
To Peter:
(Is outcomment proper english?)
I have just looked at the OXFORD Advanced Learner's Dictionary and when out
is used in the beginning of a word it means to expand or similar things e.g.
outbuilding. So outcomment must be to expand the comment :-)
-----Original Message-----
From: address@hidden
[mailto:address@hidden Behalf Of Peter Hierholzer
Sent: Thursday, May 27, 2004 9:02 AM
To: 'Andrew McNabb'; address@hidden
Subject: AW: [avr-gcc-list] Timer Interrupt Problem on ATmega 103L
Hi Andrew,
I have checked your code in the AVRStudio Simulator and it is working fine.
With the statement ASSR = _BV(AS0); your are using a separate crystal as
clock source for timer0. It looks like that this clock does not work.
Did you connect a 32 kHz crystal to TOSC1 and TOSC2?
Is it oscillating?
Does it work if you outcomment the line ASSR = _BV(AS0);
(Is outcomment proper english?)
mfg
Peter
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22-05-2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 22-05-2004
Re: [avr-gcc-list] Timer Interrupt Problem on ATmega 103L, 'Andrew McNabb', 2004/05/27
Re: [avr-gcc-list] Timer Interrupt Problem on ATmega 103L, Andrew McNabb, 2004/05/28