Hallo,
ich möchte im AVR-Studio4 folgendes PWM-Programm "build"en. Dabei
erhalte ich folgende Fehlermeldung:
c:/program files (x86)/atmel/avr tools/avr
toolchain/bin/../lib/gcc/avr/4.5.1/../../../../avr/bin/ld.exe:
_motor2.map: No such file: No such file or Directory
woran liegt das?
•
1 | #include<avr/io.h>
|
2 | #define F_CPU 20000000UL //Taktfrequenz 20MHz
|
3 | #include<util/delay.h> // Verzögerung
|
4 |
|
5 | int main(void)
|
6 | {
|
7 | DDRB |= (1<<PB0); //initialisieren Output 14 [Motor rechtslauf]
|
8 | DDRD |= (1<<PD5); //initialisieren Output 11 [LED]
|
9 | TCCR2B = (1<<CS21)|(1<<CS20); //Clock select
|
10 | TCCR2A = (1<<COM2A1) | (1<<WGM21) | (1<<WGM20); //Waveform generation mode
|
11 | OCR2A = 127; //50% cycle
|
12 | uint8_t speed; //unsigned int Variabelle speed
|
13 | PORTD |= (1<<PD5); //LED einschalten
|
14 | while(1)
|
15 | {
|
16 | // increasing speed
|
17 | for (speed = 0; speed < 255; ++speed)
|
18 | {
|
19 | // set the speed as duty cycle
|
20 | OCR2A = speed;
|
21 | //Verzögerung um Änderung zu erkennen
|
22 | _delay_ms(10);
|
23 | }
|
24 | // decreasing speed
|
25 | for (speed = 255; speed > 0; --speed)
|
26 | {
|
27 | // set the speed as duty cycle
|
28 | OCR2A = speed;
|
29 | //Verzögerung, um Änderung zu erkennen
|
30 | _delay_ms(10);
|
31 | }
|
32 | }
|
33 | return 0;
|
34 | }
|
genau so bei dem Programm:
•
1 | #include<avr/io.h>
|
2 | #define F_CPU 20000000UL //Taktfrequenz 20MHz
|
3 | #include<util/delay.h> // Verzögerung
|
4 |
|
5 | int main(void)
|
6 | {
|
7 | unsigned char duty_cyc_a,duty_cyc_b;
|
8 | DDRB |= (1 << PB0); //initialisieren Output 14 [4A]
|
9 | DDRD |= (1 << PD5); //initialisieren Output 11 [LED]
|
10 |
|
11 | PORTD |= (1<<PD5); //LED einschalten
|
12 | // Initial TIMER0 Fast PWM
|
13 | // Fast PWM Frequency = fclk / (N * 256), Where N is the Prescaler
|
14 | // f_PWM = 11059200 / (64 * 256) = 675 Hz
|
15 | TCCR0A = 0b10100011; // Fast PWM 8 Bit, Clear OCA0/OCB0 on Compare Match, Set on TOP
|
16 | TCCR0B = 0b00000011; // Used 64 Prescaler
|
17 | TCNT0 = 0; // Reset TCNT0
|
18 | OCR0A = 0; // Initial the Output Compare register A & B
|
19 | OCR0B = 0;
|
20 | duty_cyc_a=0; // Initial Duty Cycle for Channel A
|
21 | duty_cyc_b=255; // Initial Duty Cycle for Channel B
|
22 |
|
23 | for(;;) // Loop Forever
|
24 | {
|
25 | while(duty_cyc_a < 255) {
|
26 | OCR0A=duty_cyc_a++;
|
27 | OCR0B=duty_cyc_b--;
|
28 | _delay_ms(10);
|
29 | }
|
30 |
|
31 | while(duty_cyc_b < 255) {
|
32 | OCR0A=duty_cyc_a--;
|
33 | OCR0B=duty_cyc_b++;
|
34 | _delay_ms(10);
|
35 | }
|
36 | }
|
37 | return 0;
|
38 | }
|