hallo zusammen, kann jemand mir bitte sagen, welche Bibliotheken ich an meinem Programm, wohl in C geschrieben anhängen muss, bis dieser verdammte AT90PWM3B endlich zu laufen beginnt. danke kaveh
Du mußt gar nichts anhängen, das macht der Compiler/Linker... Allerdings mußt du ihm sagen, wo er was zu suchen und zu finden hat. Eine genauere Aussage gibt es ohne Kristallkugel nicht :-/ Da fehlen wohl noch ein paar Informationen im Beitrag "Mit ATmega8 funktioniert aber mit AT90PWM3B nicht!"
Ich hab dir doch hier Beitrag "Re: Problemm mit Compiler?" schon eine ziemlich ausführliche Schritt - Für Schritt Anleitung gepostet, was es alles zu tun gibt. Also hör auf zu fluchen. Atmel kann nichts dafür, wenn du mit 5 Files und ein paar Fehlermeldungen überfordert bist.
Hier das Projekt im AVR Studio Aber vergleich wenigstens mit deinem Projekt. Sowohl Projektaufbau als auch die Files. Damit du wenigstens ein bischen was dabei lernst.
Hallo, ich habe nun mit diesem Programmversucht: einfacher geht wirklich nicht mehr #include <avr/io.h> // (1) int main (void) { // (2) DDRB = 0xff; // (3) PORTB = 0xff; // (4) while(1) { // (5a) /* "leere" Schleife*/ // (5b) } // (5c) /* wird nie erreicht */ return 0; // (6) } erst mit Atmega8 >> ergebnis es läuft. ich sehe im verzeichnis eine Hex Datei. die LEDs am Port B leuchten dann mit AT90pwm3b versucht >> ergebnis es läuft nicht. ich finde keine Hex Datei im Verzeichnis, wo ich dieses programm gespeichert habe. simulieren kann ich es auch nicht, weil Toggel Breakpunkt mit einem roten Punkt versehen ist. Die LEDs am PortB leuchten nicht. bekomme diese Meldung : c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crt 90pwm3b.o: file not recognized: File format not recognized make: *** [Übung.elf] Error 1 Build failed with 1 errors and 0 warnings... Vielleicht weiß jetzt jemand Bescheid. danke Kaveh
Hallo Karl heinz, hast Du vielleicht das Projekt, was Du mir vorhin geschickt hast, selbes ausprobiert? ich bin genau so vorgegengen, wie Du es mir beschrieben hast. zum schluss kommt die Meldung: Build failed with 1 errors and 0 warnings... und im verzeichniss default/dep ist keine HEX-File vorhanden. sonder da steht main.o.d. daher kann es auch nichts übertragen werden. gegen lernen habe ich auch nicht, lernen schadet nicht mfg kaveh
> bekomme diese Meldung : > c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/crt 90pwm3b.o: > file not recognized: File format not recognized Die Meldung kommt wohl vom Linker. Das scheint mir darauf hinzudeuten, dass die Startdatei eine Macke hat, also die WinAVR-Installation im Eimer ist. Neuinstallation könnte helfen.
Ja, ich habs durchcompiliert. Für den at90pwm3b Mach das Projekt auf, drück auf Rebuild All Meine Version vom AVR-Studio + WinAvr machen das anstandslos
Hallo nochmal, ich habe die datei Oneramp.zip (68,5 KB, 4 Downloads)mit AVR-studio ausprobiert und es hat funktioniert. ich kann das programm auf den Controller AT90pwm3B übertragen und die pwm-signale mit oscilloscope sichtbar machen. nun habe ich auf der Atmelseite... (http://www.atmel.com/dyn/products/tools_card.asp?tool_id=3901)... ein programmcode in C für die Steuerung eines Ac/Motor gefunden....(AVR494: AC Induction Motor Control Using the constant V/f Principle and a Natural PWM Algorithm)... und ich habe es versucht mit AVR-Studio zu compilieren, um anschließend auf den Controller zu übertragen. Am Anfang gab es viele Fehlermeldungen aber ich habe das programm in sofern geändert, dass ich nur einen Fehlermeldung bekomme. Aber den kann ich nicht beheben.vielleicht hat jemand einen Tipp für mich und kann mir helfen. eine andere Frage wäre, es sind sinus-tabellen dabei, wo soll ich die anhängen?? danke Kaveh ps: hier das programm,was ich zu teil geändert habe. /** * @file main.c * * Copyright (c) 2004 Atmel. * * @brief Ce fichier permet de commander un moteur asynchrone par une loi en U/f * * This file is included by all source files in order to access to system wide * configuration. * @version 1.0 (CVS revision : 1.6) * @date 2006/03/08 17:02:28 (created on 06/04/2004) * @author raubree (created by Emmanuel David) ************************************************************************ *****/ #include "config.h" #include "avr/io.h" #include "mcu.h" #include "PSC_drv.h" #include "compiler.h" #include "avr/interrupt.h" #pragma vector = TIMER0_COMPA_vect //__interrupt void Tech(void); #pragma vector = ADC_vect //__interrupt void Read_measure(void); #define MAX_THETA 120 // one quarter of the circle #define MAX_THETAx2 240 #define MAX_THETAx3 360 #define MAX_THETAx4 480 #define MAX_PWM 2666 // 64MHz (PLL frequency) 2666 2 = 12 kHz (PWM frequency) #define DeadTime 32 // 32 => temps mort = 0.5 µs #define MAX_AMPLITUDE ((MAX_PWM / 2) - DeadTime) #define K_scal 32 // used for the angle integrator volatile U8 Flag_IT_timer0=0; volatile U8 Flag_IT_ADC=0 ; U16 Softcounter = 0 ; S16 Omega_meas; S16 Omega_ref = -160; S16 Command = 0; U16 theta1=0, theta2=160, theta3=320 ; U16 amplitude , OmegaTe = 64 ; U8 direction = 0 ; U16 PWM0, PWM1, PWM2; U8 Counter_PE1; // U16 DACoutput; void ADC_Init(void); void ADC_start_conv(void); void DAC_Init(void); void init(void); void PSC_Init(unsigned int ot0, unsigned int ot1); void PSC0_Load (unsigned int dt0, unsigned int dt1); void PSC1_Load (unsigned int dt0, unsigned int dt1); void PSC2_Load (unsigned int dt0, unsigned int dt1); void PSC_Load (unsigned int dt0a, unsigned int dt1a, unsigned int dt0b, unsigned int dt1b, unsigned int dt0c, unsigned int dt1c); S16 mc_control_speed_16b(S16 speed_ref , S16 speed_measure); U16 controlVF(U16 wTs); S16 read_acquisition(void) ; U16 duty_cycle(U16 theta, U16 Vm) ; /** * @brief main */ int main(void) { /* remove CKDIV8 fuse effect */ CLKPR = 0x80; CLKPR = 0x00; init(); // DAC_Init(); ADC_Init(); PSC_Init(0x00, MAX_PWM); while(1) { if (Flag_IT_timer0) /* 0.5 mS */ { if (Counter_PE1 != 0) { Counter_PE1 --; } else { Toggle_PE1(); Counter_PE1 = 250; } ADC_start_conv(); Flag_IT_timer0 = 0; // generates speed reference steps in the software Softcounter += 1 ; if (Softcounter == 2500) { Omega_ref = -320 ; } //-128; } if (Softcounter == 5000) { Omega_ref= -160 ; } if (Softcounter == 7500) { Omega_ref= 160 ; } if (Softcounter == 10000) { Omega_ref= 320 ; Softcounter = 0 ; } } if (Flag_IT_ADC) { // get the measured speed from the ADC Omega_meas = read_acquisition(); // compute the stator frequency (PI controller) // Command = mc_control_speed_16b(Omega_ref,Omega_meas); // Command = Omega_ref ; // command with the generated steps // Command = (25 * (256 + 18 - Omega_meas))/8; // command with the 0-10V input Command = ((512 - Omega_meas)*16) / 10; // command with the on board pot // direction management : extract sign and absolute value if (Command > (S16)(0) ) { direction = 0 ; OmegaTe = Command; } else { direction = 1 ; OmegaTe = (~Command) + 1; } //direction = 0 ; if ( OmegaTe > K_scal ) { // ------------------------ V/f law -------------------------- amplitude = controlVF(OmegaTe); if (amplitude > MAX_AMPLITUDE) { amplitude = MAX_AMPLITUDE ; } // ------------------ natural PWN algorithm ------------------ PWM0 = duty_cycle(theta1,amplitude); PWM1 = duty_cycle(theta2,amplitude); PWM2 = duty_cycle(theta3,amplitude); } else /* null speed */ { PWM0 = 0; PWM1 = 0; PWM2 = 0; } // -------- load the PSCs with the new duty cycles ----------- if (direction==0) { PSC_Load (PWM0, PWM0+DeadTime, PWM1, PWM1+DeadTime, PWM2, PWM2+DeadTime); } else { PSC_Load (PWM0, PWM0+DeadTime, PWM2, PWM2+DeadTime, PWM1, PWM1+DeadTime); } // 3 integrators for the evolution of the angles theta1 = ((U32)K_scal*theta1 + OmegaTe) / K_scal ; theta2 = theta1 + 160 ; theta3 = theta1 + 320 ; if (theta1>=MAX_THETAx4) {theta1 -= MAX_THETAx4;Toggle_PC7();} if (theta2>=MAX_THETAx4) theta2 -= MAX_THETAx4; if (theta3>=MAX_THETAx4) theta3 -= MAX_THETAx4; Flag_IT_ADC=0; } /* test the overcurrent input */ if (( PIFR0 & (1<<PEV0A)) !=0 ) { /* fault on overcurrent */ Set_PC7(); Set_PC3(); Clear_PE1(); while (1) ; } } } // interrupt vector for the sampling period (Ts=1 ms) //__interrupt int Tech(int) { // Flag_IT_timer0 = 1; //} // interrupt vector for the ADC (end of conversion) //__interrupt int Read_measure(int) { // Flag_IT_ADC = 1; } Die Fehlermeldung lautet :../pwm3-ac-ctrl-motor-0_0_6.c:225: error: expected identifier or '(' before '}' token
Hallo nochmal, ich habe die datei Oneramp.zip (68,5 KB, 4 Downloads)mit AVR-studio ausprobiert und es hat funktioniert. ich kann das programm auf den Controller AT90pwm3B übertragen und die pwm-signale mit oscilloscope sichtbar machen. nun habe ich auf der Atmelseite... (http://www.atmel.com/dyn/products/tools_card.asp?t...)... ein programmcode in C für die Steuerung eines Ac/Motor gefunden....(AVR494: AC Induction Motor Control Using the constant V/f Principle and a Natural PWM Algorithm)... und ich habe es versucht mit AVR-Studio zu compilieren, um anschließend auf den Controller zu übertragen. Am Anfang gab es viele Fehlermeldungen aber ich habe das programm in sofern geändert, dass ich nur einen Fehlermeldung bekomme. Aber den kann ich nicht beheben.vielleicht hat jemand einen Tipp für mich und kann mir helfen. eine andere Frage wäre, es sind sinus-tabellen dabei, wo soll ich die anhängen?? danke Kaveh ps: hier das programm,was ich zu teil geändert habe. /** * @file main.c * * Copyright (c) 2004 Atmel. * * @brief Ce fichier permet de commander un moteur asynchrone par une loi en U/f * * This file is included by all source files in order to access to system wide * configuration. * @version 1.0 (CVS revision : 1.6) * @date 2006/03/08 17:02:28 (created on 06/04/2004) * @author raubree (created by Emmanuel David) ************************************************************************ *****/ #include "config.h" #include "avr/io.h" #include "mcu.h" #include "PSC_drv.h" #include "compiler.h" #include "avr/interrupt.h" #pragma vector = TIMER0_COMPA_vect //__interrupt void Tech(void); #pragma vector = ADC_vect //__interrupt void Read_measure(void); #define MAX_THETA 120 // one quarter of the circle #define MAX_THETAx2 240 #define MAX_THETAx3 360 #define MAX_THETAx4 480 #define MAX_PWM 2666 // 64MHz (PLL frequency) 2666 2 = 12 kHz (PWM frequency) #define DeadTime 32 // 32 => temps mort = 0.5 µs #define MAX_AMPLITUDE ((MAX_PWM / 2) - DeadTime) #define K_scal 32 // used for the angle integrator volatile U8 Flag_IT_timer0=0; volatile U8 Flag_IT_ADC=0 ; U16 Softcounter = 0 ; S16 Omega_meas; S16 Omega_ref = -160; S16 Command = 0; U16 theta1=0, theta2=160, theta3=320 ; U16 amplitude , OmegaTe = 64 ; U8 direction = 0 ; U16 PWM0, PWM1, PWM2; U8 Counter_PE1; // U16 DACoutput; void ADC_Init(void); void ADC_start_conv(void); void DAC_Init(void); void init(void); void PSC_Init(unsigned int ot0, unsigned int ot1); void PSC0_Load (unsigned int dt0, unsigned int dt1); void PSC1_Load (unsigned int dt0, unsigned int dt1); void PSC2_Load (unsigned int dt0, unsigned int dt1); void PSC_Load (unsigned int dt0a, unsigned int dt1a, unsigned int dt0b, unsigned int dt1b, unsigned int dt0c, unsigned int dt1c); S16 mc_control_speed_16b(S16 speed_ref , S16 speed_measure); U16 controlVF(U16 wTs); S16 read_acquisition(void) ; U16 duty_cycle(U16 theta, U16 Vm) ; /** * @brief main */ int main(void) { /* remove CKDIV8 fuse effect */ CLKPR = 0x80; CLKPR = 0x00; init(); // DAC_Init(); ADC_Init(); PSC_Init(0x00, MAX_PWM); while(1) { if (Flag_IT_timer0) /* 0.5 mS */ { if (Counter_PE1 != 0) { Counter_PE1 --; } else { Toggle_PE1(); Counter_PE1 = 250; } ADC_start_conv(); Flag_IT_timer0 = 0; // generates speed reference steps in the software Softcounter += 1 ; if (Softcounter == 2500) { Omega_ref = -320 ; } //-128; } if (Softcounter == 5000) { Omega_ref= -160 ; } if (Softcounter == 7500) { Omega_ref= 160 ; } if (Softcounter == 10000) { Omega_ref= 320 ; Softcounter = 0 ; } } if (Flag_IT_ADC) { // get the measured speed from the ADC Omega_meas = read_acquisition(); // compute the stator frequency (PI controller) // Command = mc_control_speed_16b(Omega_ref,Omega_meas); // Command = Omega_ref ; // command with the generated steps // Command = (25 * (256 + 18 - Omega_meas))/8; // command with the 0-10V input Command = ((512 - Omega_meas)*16) / 10; // command with the on board pot // direction management : extract sign and absolute value if (Command > (S16)(0) ) { direction = 0 ; OmegaTe = Command; } else { direction = 1 ; OmegaTe = (~Command) + 1; } //direction = 0 ; if ( OmegaTe > K_scal ) { // ------------------------ V/f law -------------------------- amplitude = controlVF(OmegaTe); if (amplitude > MAX_AMPLITUDE) { amplitude = MAX_AMPLITUDE ; } // ------------------ natural PWN algorithm ------------------ PWM0 = duty_cycle(theta1,amplitude); PWM1 = duty_cycle(theta2,amplitude); PWM2 = duty_cycle(theta3,amplitude); } else /* null speed */ { PWM0 = 0; PWM1 = 0; PWM2 = 0; } // -------- load the PSCs with the new duty cycles ----------- if (direction==0) { PSC_Load (PWM0, PWM0+DeadTime, PWM1, PWM1+DeadTime, PWM2, PWM2+DeadTime); } else { PSC_Load (PWM0, PWM0+DeadTime, PWM2, PWM2+DeadTime, PWM1, PWM1+DeadTime); } // 3 integrators for the evolution of the angles theta1 = ((U32)K_scal*theta1 + OmegaTe) / K_scal ; theta2 = theta1 + 160 ; theta3 = theta1 + 320 ; if (theta1>=MAX_THETAx4) {theta1 -= MAX_THETAx4;Toggle_PC7();} if (theta2>=MAX_THETAx4) theta2 -= MAX_THETAx4; if (theta3>=MAX_THETAx4) theta3 -= MAX_THETAx4; Flag_IT_ADC=0; } /* test the overcurrent input */ if (( PIFR0 & (1<<PEV0A)) !=0 ) { /* fault on overcurrent */ Set_PC7(); Set_PC3(); Clear_PE1(); while (1) ; } } } // interrupt vector for the sampling period (Ts=1 ms) //__interrupt int Tech(int) { // Flag_IT_timer0 = 1; //} // interrupt vector for the ADC (end of conversion) //__interrupt int Read_measure(int) { // Flag_IT_ADC = 1; } Die Fehlermeldung lautet :../pwm3-ac-ctrl-motor-0_0_6.c:225: error: expected identifier or '(' before '}' token
Kaveh schrieb: > Die Fehlermeldung lautet :../pwm3-ac-ctrl-motor-0_0_6.c:225: error: > expected identifier or '(' before '}' token Welches ist die Zeile 255? (Zeile lesen) Was steht unmittelbar vor der } Eventuell auch noch eine oder 2 Zeilen zurückgehen. Vergessene ; können auch zu merkwürdigen Fehlermeldungen führen, wenn sie an den richtigen Stellen fehlen. vernünftige Einrückschemata helfen bei der Suche nach Fehlern in der { } Hierarchie.
vernünftige Einrückschemata helfen bei der Suche nach Fehlern in der { } Hierarchie. Das hier ....
1 | }
|
2 | // interrupt vector for the sampling period (Ts=1 ms)
|
3 | //__interrupt int Tech(int) {
|
4 | // Flag_IT_timer0 = 1;
|
5 | //}
|
6 | |
7 | // interrupt vector for the ADC (end of conversion)
|
8 | //__interrupt int Read_measure(int) {
|
9 | // Flag_IT_ADC = 1;
|
10 | |
11 | }
|
sieht zumindest suspekt aus. Wenn die obere } schon ganz am linken Rand war UND das Einrückschema sauber ist, dann kann die untere } nicht auch am linken Rand sein, weil dazwischen keine { ist.
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.