go_away

Author Topic: Help! I try to build my project i get servo.c:41: error: 'TIMSK1' undeclared (  (Read 6012 times)

0 Members and 1 Guest are viewing this topic.

Offline rox2007Topic starter

  • Full Member
  • ***
  • Posts: 95
  • Helpful? 0
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

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
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...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline rox2007Topic starter

  • Full Member
  • ***
  • Posts: 95
  • Helpful? 0
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.

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
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
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline rox2007Topic starter

  • Full Member
  • ***
  • Posts: 95
  • Helpful? 0
Thank you very musch

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
no problemo...
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

Offline rox2007Topic starter

  • Full Member
  • ***
  • Posts: 95
  • Helpful? 0
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

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,663
  • Helpful? 169
    • Society of Robots
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"

Offline rox2007Topic starter

  • Full Member
  • ***
  • Posts: 95
  • Helpful? 0
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

Offline superchiku

  • Supreme Robot
  • *****
  • Posts: 953
  • Helpful? 5
  • cooll
no ull learn well and fast
JAYDEEP ...

IT AND ROBOTICS ENGINEER

"IN THE END IT DOESNT EVEN MATTER"

 


Get Your Ad Here

data_list