Страница 1 из 1

Помогите найти ошибку.

Добавлено: Сб апр 06, 2013 17:52:12
don7272
/*****************************************************
This program was produced by the
CodeWizardAVR V2.05.3 Standard
Automatic Program Generator
© Copyright 1998-2011 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com

Project :
Version :
Date : 07.04.2013
Author : PerTic@n
Company : If You Like This Software,Buy It
Comments:


Chip type : ATtiny13
AVR Core Clock frequency: 8,000000 MHz
Memory model : Tiny
External RAM size : 0
Data Stack size : 16
*****************************************************/

#include <tiny13.h>


// Declare your global variables here

void main(void)
{
// Declare your local variables here

// Crystal Oscillator division factor: 1
#pragma optsize-
CLKPR=0x80;
CLKPR=0x00;
#ifdef _OPTIMIZE_SIZE_
#pragma optsize+
#endif

// Input/Output Ports initialization
// Port B initialization
// Func5=In Func4=In Func3=In Func2=In Func1=Out Func0=Out
// State5=T State4=T State3=T State2=T State1=0 State0=0
PORTB=0x00;
DDRB=0x03;

while (1)
{
interrupt[EXT_INT0]void ext_int0_isr(void);
{
}
}
unsigned char real_adc(insigned char adc_input);
void open_simistor(void).

}
}
пишет ошибку:Error: C:\prog..c(49): 'interrupt' or '__interrupt' attributes not allowed in this context

Re: Помогите найти ошибку.

Добавлено: Сб апр 06, 2013 19:09:17
Goodefine
Вынесите interrupt из main(), компилятор достаточно прямо на это намекает.

Re: Помогите найти ошибку.

Добавлено: Вс апр 07, 2013 03:40:48
don7272
Я дико извиняюсь, но я только учусь.Можно ткнуть пальцем, туго доходит.

Re: Помогите найти ошибку.

Добавлено: Вс апр 07, 2013 04:06:05
Vov123

Код: Выделить всё

#include <tiny13.h>

// Declare your global variables here

unsigned char real_adc(unsigned char adc_input)
{
}
void open_simistor(void)
{
}

interrupt[EXT_INT0]void ext_int0_isr(void)
{
}

void main(void)
{
// Declare your local variables here



// Crystal Oscillator division factor: 1
#pragma optsize-
CLKPR=0x80;
CLKPR=0x00;
#ifdef _OPTIMIZE_SIZE_
#pragma optsize+
#endif

// Input/Output Ports initialization
// Port B initialization
// Func5=In Func4=In Func3=In Func2=In Func1=Out Func0=Out
// State5=T State4=T State3=T State2=T State1=0 State0=0
PORTB=0x00;
DDRB=0x03;

while (1)
{

}
}

Re: Помогите найти ошибку.

Добавлено: Вс апр 07, 2013 04:28:05
don7272
СПАСИБО ВСЕМ КТО ПОМОГАЕТ ОСВАИВАТЬ микроконтроллер начинающему!!!
Вот переделал.Правильно?Теперь пишет - Error: C:\migat.c(28): '(' expected
#include <tiny13.h>
// Declare your local variables here

// Crystal Oscillator division factor: 1
#pragma optsize-
CLKPR=0x80;-сюда ссылается ошибка
CLKPR=0x00;
#ifdef _OPTIMIZE_SIZE_
#pragma optsize+
#endif
// Declare your global variables here

void main(void)
{
// Declare your global variables here

// Input/Output Ports initialization
// Port B initialization
// Func5=In Func4=In Func3=In Func2=In Func1=Out Func0=Out
// State5=T State4=T State3=T State2=T State1=0 State0=0
PORTB=0x00;
DDRB=0x03;

while (1)
{
interrupt[EXT_INT0]void ext_int0_isr(void);
unsigned char read_adc(unsigned char adc_input);
void open_simistor(void).

}
}

Re: Помогите найти ошибку.

Добавлено: Вс апр 07, 2013 04:55:05
Vov123
Прошу пардону.Ошибки копи-пасте задолбали.Исправил с 10 раза.
Функции

Код: Выделить всё

unsigned char real_adc(insigned char adc_input);
void open_simistor(void);
объявлены,также как и прерывания,но не описаны.Так что бесполезны.
Как и вся ваша программа.