Hallo, ich habe folgendes programm im AVR studio4 compilier und ich bekomme Fehlermeldung, dass die headerdatei mega16, und spi nicht gefunden wurde. Frage: Wo kann ich die headerdatei von Atmega 16 und spi bus finden und wie kann ich die im programm einfügen so, dass solche fehlermung nicht mehr erscheint. Es händelt um ein Atmega 16 und Spi bus mit ADC-programmieren und ich habe auch keine headerdatie zur verfügung. Erhalten sie unten das Programm: #include <avr\mega16.h> #include <stdio.h> #include <stdlib.h> #include <avr/spi.h> #include <util/delay.h> #include <avr\io.h> #include <avr/interrupt.h> // MAX147 externe Spannungsreferenz [mV] - nicht für MAX 146 erf. #define VREF 2500 // MEGA 16 SPI-Leitungen für MAX146/147 #define NCS PORTB//.4 // MAX146-Pin 18 ---> 13 CON 1 auf Erweiterungsboard #define DOUT PINB//.5 // MAX146-Pin 17 ---> 14 // SCLK MAX146 Pin 19 ---> 19 // DOUT MAX146 Pin 15 ---> 15 //muss man noch ändern #define UCSRA PORTB #define UCSRB PORTB #define UBRRL PORTB #define GICR PORTB union adcu { unsigned char byte[2]; unsigned int word; }; //interrupt [EXT_INT0] void ext_int0_isr(void) void ext_int0_isr(void) // Taste 1 auf Polliboard { PORTD=0x60; //Leds ein-aus _delay_ms (1000); PORTD=0x00; _delay_ms(1000); } void uartinit(void) { UCSRA=0x00; UCSRB=0x58; //TXD enable, 8 Bit bei 90S8535 UCR UBRRL=0x33; //9600 Baud bei 8 MHz Quarz bei 90S8535 UBRR } // Funktion f. eine AD-Wandlung - Wert zurück unsigned int max147_read(unsigned char kan) { union adcu adc_data; unsigned char TB1, RB1, RB2, RB3; //control byte f. Max 147 //TB1=0x8F; Kan. 0 ..., externe clock f. AD TB1=0x8e; //Start, Kan. 7, unipolar, //single ended, interne clock für AD if (kan==0) TB1=0x8e; else if (kan==1) TB1=0xce; else if (kan==2) TB1=0x9e; else if (kan==3) TB1=0xde; else if (kan==4) TB1=0xae; else if (kan==5) TB1=0xee; else if (kan==6) TB1=0xbe; else if (kan==7) TB1=0xfe; NCS=0; //Chip Select f. Max 147 _delay_us(100); SPDR=TB1; /////////RB1=spi(0); //SPDR=0x00; ///////RB2=spi(0); //SPDR=0x00; ////////RB3=spi(0); NCS=1; //deselect f. MAX147 _delay_us(10); adc_data.byte[1]=RB2; adc_data.byte[0]=RB3; return(adc_data.word>>3)&0xfff; } void main(void) { unsigned n1, n2, n3; // Ergebnis der AD-Wandlung float mittelw; // Einstellung f. printf auf float with precision unsigned char kan; // Input/Output Ports initialization // Port A DDRA=0x00; PORTA=0x00; DDRD=0x60; //Leds // Port B // the /SS pin is set as an output // with level 1, it's required by // the SPI to work in master mode //------ mega16 ------ // //PB.7=SCLK PB.6=MISO PB.5=MOSI PB.4=SS // DDRB=0xB0; PORTB=0xB0; // Port C DDRC=0x00; PORTC=0x00; uartinit(); // SPI initialization des uP 90S8535 // SPI Type: Master // SPI Clock Rate: 921.6 kHz=3.6864 MHz/4 // // SPI Clock Phase: Cycle Half // SPI Clock Polarity: Low // SPI Data Order: MSB First SPCR=0x50; //putsf("\rMAX147 Demo\n"); //putsf("\r***********************************************\n"); _delay_us(100); while (1) { /* for (kan=0; kan<8; kan++) { n=max147_read(kan); printf("Kanal= %2u N=%4u U=%4umV\r\n",kan, n,(unsigned) ((long) n*VREF/4096)); } */ kan=0; n1=max147_read(kan); printf("\r%4u\r", (unsigned) ((long) n1*VREF/4096)); n2=max147_read(kan); printf("%4u\r", (unsigned) ((long) n2*VREF/4096)); n3=max147_read(kan); printf("%4u\r", (unsigned) ((long) n3*VREF/4096)); mittelw= (float) ((n1+n2+n3)/3); printf("------> Mittelw: %f\r", mittelw*VREF/4096); _delay_ms(500); GICR=0x40; MCUCR=0x02; sei(); }; } Die Fehlermeldung sieht so aus: ../skand.c:11:24: error: avr\mega16.h: No such file or directory ../skand.c:14:17: error: spi.h: No such file or directory ich bedanke mich für Ihre Hilfe
du inkludierst keine mega.h Du inkludierst #include <avr/io.h> und die kümmert sich darum, dass je nach eingestelltem Prozessor dann das richtige prozessorspezifische File inkludiert wird. Und eine spi.h gibt es nicht. Zumindest nicht beim AVR-GCC
Vielen Dank für Ihr Hinweis Herr Karl heinz Buchegger, ich habe alles so eingestellt wie Sie gesagt haben. Aber es jetzt nur ein Fehler und zwar dieser: make: *** No rule to make target `../skand.c', needed by `skand.o'. Stop. was soll ich jetzt tun danke.
Bitte ausführlich erklären wie ich device deklarieren kann bitte ich bin auch noch emfänger, danke.
Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.