Society of Robots - Robot Forum

Software => Software => Topic started by: rox2007 on April 19, 2008, 10:12:23 AM

Title: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (
Post 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
Title: Re: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (
Post by: superchiku on April 19, 2008, 10:22:48 AM
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...
Title: Re: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared
Post by: rox2007 on April 19, 2008, 11:33:31 AM
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.
Title: Re: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (
Post by: superchiku on April 19, 2008, 12:06:23 PM
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
Title: Re: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (
Post by: rox2007 on April 19, 2008, 01:08:22 PM
Thank you very musch
Title: Re: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (
Post by: superchiku on April 19, 2008, 01:14:20 PM
no problemo...
Title: Re: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (
Post by: rox2007 on April 19, 2008, 04:10:52 PM
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
Title: Re: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (
Post by: Admin on April 26, 2008, 05:39:45 PM
It sounds like you didn't put timer.c in the makefile.

Code: [Select]
# 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.
Code: [Select]
#include "timer.h"
Title: Re: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (
Post by: rox2007 on June 04, 2008, 11:06:11 PM
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
Title: Re: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (
Post by: superchiku on June 04, 2008, 11:12:10 PM
no ull learn well and fast