Skip navigation
TechXchange
Digi-Key TechXchange Communities > Projects and Designs > Documents
Currently Being Moderated

debug Errors for the program dumped in avrstudio4?  Can u solve this problems?

VERSION 1 
Created on: Mar 27, 2012 9:55 AM by umadevi - Last Modified:  Mar 8, 2013 2:14 PM by umadevi

Thanking you sir, But when I executing this it shows 11 errors. I think the program is correct. can u tell me how to remove the errors,

#include <avr/io.h>

#include <util/delay.h>

 

 

/*

* Assumptions:

*      - LEDs connected to PORTB.7 and PORTB.6

*/

 

 

int main (void)

{

     /* Waveform Generation Mode 3 - Fast PWM */

     TCCR0A |= _BV(WGM01) | _BV(WGM00);

 

 

     /*

      * Compare Output Mode - fast PWM

      * Non-inverting mode drives the output high while the counter

      * is greater than OCRNx. Inverting mode drives the output low

      * while the counter is greater than OCRNx.

      */

     TCCR0A |= _BV(COM0A1) | _BV(COM0A0); /* inverting: fade down */

     TCCR0A |= _BV(COM0B1); /* non-inverting: fade up */

 

 

     /* reset all the timers and comparators */

     OCR0A = 0;

     OCR0B = 0;

     TCNT0 = 0;

 

 

     /*

      * Clock Source 1 - CLK. Setting this bit late allows us to

      * initialize the registers before the clocks start ticking

      */

     TCCR0B |= _BV(CS00);

 

 

     /*

      * Arduino pins 5 & 6 (PORTD.5 and PORTD.6) are PWM driven by TIMER0

      * "The setup of the OC0x should be performed before setting the Data

      * Direction Register for the port pin to output." -- S14.5.3

      */

     DDRD |= _BV(PORTD5) | _BV(PORTD6);

 

 

     while (1){

          /*

           * slowly crank up the compare register. since one output

           * is inverting, the net result is to fade from one channel

           * to the other.

           */

          OCR0A++;

          OCR0B++;

          _delay_ms(10); /* busy wait. could be done with timers too. */

     }

     return 0;

}

 

 

 

 

 

Errors:

 

 

 

Build started 27.3.2012 at 18:55:12

avr-gcc  -mmcu=atmega8 -Wall -gdwarf-2 -Os -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -MD -MP -MT control_brightness.o -MF dep/control_brightness.o.d  -c  ../control_brightness.c

In file included from ../control_brightness.c:2:

c:/winavr-20090313/lib/gcc/../../avr/include/util/delay.h:85:3: warning: #warning "F_CPU not defined for <util/delay.h>"

../control_brightness.c: In function 'main':

../control_brightness.c:12: error: 'TCCR0A' undeclared (first use in this function)

../control_brightness.c:12: error: (Each undeclared identifier is reported only once

../control_brightness.c:12: error: for each function it appears in.)

../control_brightness.c:12: error: 'WGM01' undeclared (first use in this function)

../control_brightness.c:12: error: 'WGM00' undeclared (first use in this function)

../control_brightness.c:20: error: 'COM0A1' undeclared (first use in this function)

../control_brightness.c:20: error: 'COM0A0' undeclared (first use in this function)

../control_brightness.c:21: error: 'COM0B1' undeclared (first use in this function)

../control_brightness.c:24: error: 'OCR0A' undeclared (first use in this function)

../control_brightness.c:25: error: 'OCR0B' undeclared (first use in this function)

../control_brightness.c:32: error: 'TCCR0B' undeclared (first use in this function)

make: *** [control_brightness.o] Error 1

Build failed with 11 errors and 1 warnings...

Comments (1)

Bookmarked By (0)

More Like This

  • Retrieving data ...