Society of Robots - Robot Forum
Software => Software => Topic started by: rox2007 on April 19, 2008, 10:12:23 AM
-
I am using an atmega 32.
I get this error.
I know it has to do with timing.
servo.c:41: error: 'TIMSK1' undeclared (first use in this function)
I would really appreciate any help
-
The TIMSK register is same for all the 3 timer operations of the atmega32 just the bit address changes for the 16 bit timer the bits 5,4,3,2 of the TIMSK register affect the interrupt of the 16 bit timer, for 8 bit timer TCCR0 BIT 1 AND 0 affect the interrupts and for the timer TCCR2 bits 7 and 6 affect its interrupts...
so instead of using TIMSK1 write TIMSK and only change the bits reffering to the timer your using...
-
Thanks for your help but i'm really just a newbie using AvrLib. I dont really understand everyhting you said. I changed timsk1 to timsk and it built without errors, but the part about changing the bits got me confused.
-
Hav you seen the datasheet????
It clearly mentions that the TIMSK register is common to all 3 timer channels
but the bit numbers have been divided between the 3
like u need to change bit 5,4,3,2 in order to affect the 16 bit timer interrupts....
similarly bit 1,0 affect the TCCR2 timer interrupts
sit 7,6 affect TCCR0 timer interrupts
-
Thank you very musch
-
no problemo...
-
i thought i understood it, but i dont. What are the timer channels. what ports are they on. On the atmega168 i think they were on portd
-
It sounds like you didn't put timer.c in the makefile.
# List C source files here. (C dependencies are automatically generated.)
#SRC = $(TARGET).c a2d.c timer.c uart.c buffer.c rprintf.c
Or the header file is undeclared.
#include "timer.h"
-
Sorry for the late reply. All i needed to do was change TIMSK1 to TIMSK, i'm a nub and i'm still learning.Thanks
-
no ull learn well and fast