Build error in atmel studio

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So, I wrote a simple program to blink an led in atmel studio.
Whenever I want to build the code. I receive an error message .

- recipe for target 'main.o' failed
- 'bit_is_clear' was not declared in this scope
- macro "bit_is_clear" requires 2 arguments, but only 1 given
'_delay&ms' was not declared in this scope
'else without a previous 'if'
- '_delay_ms' was not declared in this scope

Kindly check the picture to see this message.

Note am using AS 7.0

Regards

Attachment(s): 

This topic has a solution.

Oyekunle Quadri

Last Edited: Thu. Dec 5, 2019 - 01:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So you need to provide the macro bit_is_clear and also define your F_CPU speed and include the delay.h lib.

Just as the error msg says....

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Please see Tip #1 for how to take a screenshot, and how to post it!

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And how to do that as am still practically new to atmel studio

Oyekunle Quadri

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How do I do that @Jim

Oyekunle Quadri

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just wrote a tutorial on how to do replies in the forum: https://www.avrfreaks.net/forum/... - including how the forum shows what you're replying to.

 

Quadril wrote:
And how to do that as am still practically new to atmel studio

There's not really anything special about Atmel Studio here - it's standard 'C' programming stuff.

 

There's a load of introductory videos to get you started with Atmel Studio on the Atmel Studio page:

 

https://www.microchip.com/mplab/avr-support/atmel-studio-7 - scroll down to the end 

 

 

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How to set Project Defines - such as F_CPU - in Atmel Studio:

 

https://www.avrfreaks.net/commen...

 

Advantage of using the Project Defines over #defines in the source code:

 

https://www.avrfreaks.net/commen... (not specific to Atmel Studio)

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
Last Edited: Wed. Dec 4, 2019 - 09:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you for your response.

So, I uninstall the AS 7.0 as the VASSIST is grayed out and I installed AS6.0

writing the following code 

 

#define F_CPU 8000000UL
#include <avr/io.h>
#include <util/delay.h>

int main(void)
{
    DDRB |= (1<<0);
    DDRB &= ~ (1<<1);
    PORTB |= (1<<1);
    while(1)
    {
        PORTB ^= (1<<0);
        if (bit_is_clear (PINB, 1))
        _delay_ms(100);
    }
    else
    {
        _delay_ms(10);        
        //TODO:: Please write your application code 
    }
}

 

But I get the following errors

    'else' without a previous 'if'   
 

Oyekunle Quadri

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quadril wrote:

But I get the following errors

    'else' without a previous 'if'   
 

 

https://www.tutorialspoint.com/c...

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you.

 

Issue sorted!

Oyekunle Quadri

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quadril wrote:
 I uninstall the AS 7.0 ... and I installed AS6.0

That's really not a good idea!

 

7 is definitely superior to 6.

 

The errors you are reporting are not due to installation problems.

 

Please see Tip #1 for how to properly post source code, and Tip #5 for how to mark a thread as solved.

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As side from that.

I can't access the Vassist X feature of the atmel studio 7

Oyekunle Quadri

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's a separate issue - it wouldn't have helped with any of the errors reported above.

 

It would certainly be better to use AS7 instead of 6.

 

You could start a separate thread if you want help to get it working ...

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry I have been busy working at my day job, looks like Andy answered your questions.

Thanks Andy!

 

Jim

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274
get $5 free gold/silver https://www.onegold.com/join/713...