Dobrý den, s mikročipy začínám, mám tady zjevně několik chyb, ale nemůžu přijít na to, kde a proč jsou to chyby, mohli byste mi poradit prosím? Program má dvě funkce, přes RS232 pošle nebo přijme údaje a zkontroluje je. Dva z údajů jsou PWM.
[code]#include <avr/io.h> // definice periferii procesoru
#include <avr/interrupt.h> // definice funkci pro rizeni preruseni
int pwml,pwmp,l1,p1,l2,p2,pwml1,pwmp1,l11,p11,l21,p21;
int posli(){
int a;
a = getchar();
putchar(a);
PORTA.0 = PINA.0 ^ 0b00000001;
return a;
}
void posli2(int a){
int a1;
putchar(a);
a1 = getchar();
if (a == a1){
PORTA.0 = PINA.0 ^ 0b00000001;
}
}
int main(void){
DDRA=0b00000001;
DDRD=0b11111111;
//UART initialization
//Comunication Parameters: 8 Data, 1 Stop, No Parity
//UART Receiver: Off
//UART Transmitter: On
//UART Baud rate: 9600
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x33;
DDRD=0b00001010
TCCR1A=0x33;
TCCR1B=0x1D;
TCNT1H=0x00;
TCNT1L=0x00;
OCR1AH=0x55;
OCR1AL=0x55;
OCR1BH=0x00;
OCR1BL=0x50;
TCCR1B |= ( 1 << WGM13 ) | ( 1 << WGM12 );
TCCR1A |= ( 0 << WGM11 ) | ( 0 << WGM10 );
// top pro citac
ICR1 = 12500 - 1;
// clk / 64
TCCR1B |= ( 0 << CS12 ) | ( 1 << CS11 ) | ( 1 << CS10 );
// povoleni preruseni IC
TIMSK |= ( 1 << TICIE1 );
// globalni maska preruseni
sei();
while( 1 );
return 0;
}
SIGNAL ( SIG_INPUT_CAPTURE1 ){
l1=PIND.2;
l2=PIND.3;
pwml=OCR1B;
p1=PIND.6;
p2=PIND.7;
pwmp=OCR1A;
l1=posli();
l2=posli();
pwml=posli();
p1=posli();
p2=posli();
pwmp=posli();
PORTD.2=l1;
PORTD.3=l2;
OCR1B=pwml;
PORTD.6=p1;
PORTD.7=p2;
OCR1A=pwmp;
}[/code]
chyby jsou:
Build started 6.2.2010 at 20:25:26
avr-gcc -mmcu=atmega16 -Wall -gdwarf-2 -std=gnu99 -DF_CPU=16000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT auto.o -MF dep/auto.o.d -c ../auto.c
../auto.c: In function 'posli':
../auto.c:8: warning: implicit declaration of function 'getchar'
../auto.c:9: warning: implicit declaration of function 'putchar'
../auto.c:10: error: expected ';' before numeric constant
../auto.c: In function 'posli2':
../auto.c:19: error: expected ';' before numeric constant
../auto.c: In function 'main':
../auto.c:37: error: called object '10' is not a function
../auto.c: In function '__vector_5':
../auto.c:61: error: expected ';' before numeric constant
../auto.c:62: error: expected ';' before numeric constant
../auto.c:64: error: expected ';' before numeric constant
../auto.c:65: error: expected ';' before numeric constant
../auto.c:75: error: expected ';' before numeric constant
../auto.c:76: error: expected ';' before numeric constant
../auto.c:78: error: expected ';' before numeric constant
../auto.c:79: error: expected ';' before numeric constant
make: *** [auto.o] Error 1
Build failed with 11 errors and 2 warnings...
Děkuji za odpověď.
administrator: přejmenováno z "Netušené chyby"
administrator: příspěvek byl upraven