Go Down

Topic: ""********** was not declared in this scope " (Read 510 times) previous topic - next topic

knuckles

in quite a few examples i load from the net when i try to compile them i can get this message come up


TIMSK was not declared in this scope as in >>

#include <avr/io.h>
#include <avr/interrupt.h>

int main(void)
{
sei();

DDRB |= 1<<PINB0;

TCCR1B |= 1<<CS10 | 1<<CS11 | 1<<WGM12;
TIMSK |= 1<<OCIE1A; //If using atmega324, this regester is TIMSK1
OCR1A = 15624;

while(1)
{
}
}

ISR(TIMER1_COMPA_vect)
{
PORTB ^= 1<<PINB0;
}



or


OUTPUT was not declared in this scope

when i try to compile code for a blink sketch which will be loaded via a UNO to a ATTINY

judging by the comments left by other users they also get the same error message but the poster of the examples never leaves a reply
so is there a general cause of such a error message ?
what does this mean ? and how do i rectify such a message ?

tuxduino

Well, looking at the 328 datasheets, it seems there's a TIMSK0 but no TIMSK.

knuckles

here is the page it was posted on

http://www.newbiehack.com/IntroductiontoInterrupts.aspx

so do i assume he has posted a faulty code?

knuckles

yep he posted a faullty code as a 0 added on to the TIMSK works fine

tuxduino

Please, /please/ next time you post code on this forum, remember to fix the indentation (CTRL-T) and use code tags. Thanks.


PaulS

Quote
yep he posted a faullty code as a 0 added on to the TIMSK works fine

The actual register names vary from board to board. Perhaps the code was intended for a different board.

Go Up