AS7 import h files

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

Dear forum

 

I am just about to do some learning on "C", I use the book from Elliot Williams "AVR Programming"

 

I use AS7 and an Arduino UNO.

 

Now I have the problem to import .h files which I have from the download site for the book.

 

Below I included USART.h and pinDefines.h.

I imported them in the direktory where the main.c is. I also can open the file in AS7 but the compiler does not see the files.

 

Can you please help a newbe and tell me what I did wrong.

 

Thanks and regards

 

 

Thats the exersise file:

 

A simple test of serial-port functionality.
Takes in a character at a time and sends it right back out,
 displaying the ASCII value on the LEDs.
*/

// ------- Preamble -------- //

#include <avr/io.h>
#include <util/delay.h>
#include <USART.h>
#include <pinDefines.h>

#include
#define LED_PORT                PORTD
#define F_CPU 16000000

int main(void) {
  char serialCharacter;

  // -------- Inits --------- //
  LED_DDR = 0xff;                            /* set up LEDs for output */
  initUSART();
  printString("Hello World!\r\n");                          /* to test */

  // ------ Event loop ------ //
  while (1) {

    serialCharacter = receiveByte();
    transmitByte(serialCharacter);
    LED_PORT = serialCharacter;
                           /* display ascii/numeric value of character */

  }                                                  /* End event loop */
  return 0;
}

 

Last Edited: Tue. Oct 1, 2019 - 05:09 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JB57 wrote:
the compiler does not see the files

You have to tell it where to find them.

 

You do this by setting the Include Path - the book should describe this?

 

Please note Tip #1

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

The book does not tell it works very manual.

 

I know I have to tell the compiler, the question is how?

 

I did of course several attemts put was not lucky and its very complicated for a beginner.

 

And I dont wont to mess up anything.

 

Maybe somebody knows

 

many thanks

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

 

Note that at this level it's really nothing specific to AVR or Atmel Studio - this is the same stuff that would apply to setting up any 'C' project in any IDE for any target.

 

This is why it's often said - including by me - that it'd probably be easier to get the hang of 'C' programming on a PC before adding the complications of AVR

 

eg, only a couple of hours ago: https://www.avrfreaks.net/commen...

 

Anyhow, to set Project Properties, right-click the Project name, and choose 'Properties':

 

 

Then go to 'Toolchain', expand 'AVR/GNU C Compiler', and select 'Directories' - and there are your Include Paths:

 

 

Use the buttons  to:

  • Add a new entry
  • Delete an existing entry
  • etc
  •  

 


 

GCC Include Search Path Documentation:  https://gcc.gnu.org/onlinedocs/gcc-8.3.0/cpp/Search-Path.html#Search-Path

 

 

 

#ASIncludePaths

 

 

 

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: Tue. Oct 1, 2019 - 05:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Links to AS7 Getting Started videos still work:

 

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

 

 

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

Thank you very much for your answer

 

I followed your instructins, but I got the same error message.

 

I also started to whatch the videos but as a non native its very hard to understand as the audio quality is quite bad and also a lot of marceting hipe

 

 

Error        #include expects "FILENAME" or <FILENAME>    GccApplication1    C:\Bearbeiten\Arduino\Programme\GccApplication1\GccApplication1\main.c    16

 

 

anyway I try to carry on searching the net.

 

thanks and regards
 

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

JB57 wrote:
I got the same error message.

You didn't actually say what message you got before!

 

Error        #include expects "FILENAME" or <FILENAME>    GccApplication1    C:\Bearbeiten\Arduino\Programme\GccApplication1\GccApplication1\main.c    16

Presumably line 16 of main.c is here:

#include <pinDefines.h>

#include                   <<<< HERE
#define LED_PORT  PORTD
#define F_CPU     16000000

 

clearly, you've missed the filename off the #include - just as the message told you!

 

So this was nothing to do with not being able to find the header files - it was just a straight syntax error.

 

 

 

 

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

JB57 wrote:
as a non native its very hard to understand

Again, I suggest that it would be easier to learn the basics of 'C' on a PC - rather than an AVR.

 

AVR is a very specialist area - so the chances of finding good resources in your own language are small.

 

But finding standard 'C' resources should be a lot easier - as it has a much wider audience.

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

Thank very much for your answer

 

No, I have not missed out the filename, but in fact I got a different Error message now. I have just started AS7 again.

 

The reason why I am interessted in "C" for mCs is, I have done a lot of assembler programming for PICs many years ago. Now I am retired and i want to do another start for little projects with "C".I want to control hardware thats why I dont want to learn via PC.

 

Well, I think my english is good enough to read and understand. I have problems with youtube if the audio is bad.

 

I have attached a picture with a screenshot, maybe you have an idea.

 

Many thanks for your patience 

 

regards 

Attachment(s): 

Last Edited: Tue. Oct 1, 2019 - 07:36 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

That screenshot makes me wonder what the first 13 lines in USART.h look like.

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

 

JB57 wrote:
No, I have not missed out the filename

Yes, you certainly have in the code that you showed!

 

If you've changed the code, then show what you actually have now.

 

but in fact I got a different Error message now

So what message, exactly, do you get now?

 

thats why I dont want to learn via PC

You are missing the point!

 

Learning on a PC is a means to your end - it will make it much easier for you to get where you require.

 

If you want to learn to swim, it's easiest to start in a swimming pool - where conditions are much easier.

There you can concentrate on the basics of swimming without all the extra troubles of cold, waves, tides, weeds, etc.

 

But it doesn't mean that you will only ever swim in a pool! Of course, you can progress to open water!

 

So similarly with learning the basics of the 'C' programming language!

 

I have attached a picture with a screenshot

Don't attach it - put it in the post where we can see it!

 

Again, see Tip #1 for instructions on how to do that.

 

Like this:

 

 

, maybe you have an idea.

Not from that screenshot.

 

The screenshot gives us no idea as to which part of the code each error relates to!

 

You can click on the messages to go to the places where those errors are detected - we can't!

 

It also means that we cannot copy & paste the messages in order to explain them to you - like I did with your previous message.

 

So, instead, go to the 'Output' view:

 

Copy the entire text from there, and post it here - using the instructions for posting source code.

 

But, as  je_ruud suggests, those errors suggest that that the problems lie in what you have not shown - that is, the code which gets included:

#include "pinDefines.h"
#include "USART.h"

 

  • The fact that you get errors saying "#include nested too deeply" suggests that you have includes including includes including includes ... possibly recursively
  • The fact that you get errors saying "redefinition of 'main'" mean that you have more than one place where 'main' is defined - possibly as a result of the above

 

 

Again, learning to deal with this kind of stuff is not specific to AVR or Atmel Studio - which is why learning these basic, non-specific skills on a PC would make your life so much easier!

 

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. Oct 2, 2019 - 08:34 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Could it be that in USART.h you actually have:

#include "main.c"

If so there are a few things wrong with that:

 

a) on the whole you never name a .c file in a #include

 

b) if the compiler (or rather the C preprocessor) starts to read main.c after a few lines it will hit the #include of USART.h - on the whole that just means "take all the lines of USART.h and insert them here" but the inclusion is slightly more intelligent than that because if the text being included, itself has #include's they will be replaced by the file contents. So as it starts to include the text of USART.h then if that file really does have a #include "main.c" then when it reaches that it will start to insert the contents of main.c but as it does that it will come to the line to #include "USART.h" again so it will then start to insert that and after a few lines that would then hit the line to #include main.c again and so on and so on and so on. In the end it will throw errors to say "#include nested too deeply".

 

c) this is why .h files should have what are known as "header guards". Instead of USART.h looking like:

some #includes

some type definitions

some function declarations

it should look like:

#ifndef USART_H_GUARD
#define USART_H_GUARD

some #includes

some type definitions

some function declarations

#endif

This time when USART.h is #included the first time it will check if a symbol called USART_H_GUARD is already defined. It won't be so it will continue to the next line (instead of skipping everything right up the #endif). The next line now defies the symbol USART_H_GUARD and the rest of the file (which may have some #include's too) is processed. But if, during later processing something else now attempts to include USART.h this time, in the #ifndef test it will find that USART_H_GUARD is already defined. So it will skip the rest of the file. This way you can't get into "loop" with cyclic inclusions.

 

d) in the Microsoft world the equivalent is "#pragma once"

 

But the real error here looks to be that you have an A that has a #include of B that then has a #include of A and that sets up an unstoppable loop.

 

Like Andy says, don't learn this stuff with AVR. If you want to learn the basics of C (including how #include works) then do it with a PC compiler on a PC. It's much quicker to build/test and the debugging is infinitely better!

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

clawson wrote:
 do it with a PC compiler on a PC.

 

Because Atmel Studio is basically the same as Microsoft Visual Studio, the obvious choice for that "PC compiler" would be Microsoft Visual Studio !

 

You can download the free Community Edition here:  https://visualstudio.microsoft.com/free-developer-offers/

 

 

 

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

clawson wrote:
.h files should have what are known as "header guards".

Absolutely!

 

Also known as "include guards".

 

Again, standard 'C' stuff - nothing specific to AVR or Atmel Studio:

 

https://en.wikipedia.org/wiki/Include_guard

 

And you can see examples in the two headers you used:

#include <avr/io.h>
#include <util/delay.h>

In delay.h:

#ifndef _UTIL_DELAY_H_
#define _UTIL_DELAY_H_ 1

:
:

#endif /* _UTIL_DELAY_H_ */

In io.h:

#ifndef _AVR_IO_H_
#define _AVR_IO_H_

:
:

#endif /* _AVR_IO_H_ */

 

(but note that names beginning with underscores are reserved)

 

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. Oct 2, 2019 - 08:50 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Apart from purely as a learning tool, having a 'C' compiler (and IDE) on your computer is a very valuable tool for embedded development in general:

 

  • For writing test & support utilities;
  • For trying-out, testing, and debugging non hardware dependent code.

 

EDIT

 

Another common use (often mentioned here) is in generating code to be used in your embedded system; eg,

  • Generate lookup table contents
  • Convert a .WAV file to 'C' data
  • Convert an image file to 'C' data

 

(although utilities exist for the last 2)

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. Oct 2, 2019 - 09:41 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you very much for your great efforts.

 

Let me tell you what happend. I did start allover again, started AS7 and reloaded the sample C- file.

 

I trid to compile and received another different error message, saying that "F_CPU has to be a constant", no idea what it realy means.

 

Anyway, I did try several changes in the C/h- files and it turned out that as soon as I entered: "#define F_CPU 16000000UL" in the USART.h it compiled with no errors and I also was able to upload to the UNO. No idea where the previous errors came from.

 

Now I have to go on to get the sample working and get a connection to a terminal software on the PC via asynchronous serial line, thats the goal of the exercise.

 

I still have to study all the information you gave me and I am very gratefull and thanks again for your time.

 

Have a nice day

regards

 

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

Whether you #define F_CPU or not would NOT explain the "#include nested too deeply" messages - so you clearly changed something else as well.

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

JB57 wrote:
Let me tell you what happend. I did start allover again, started AS7 and reloaded the sample C- file.

What "sample C file" ?

 

Simply loading random source files isn't a great learning strategy.

 

Again, you really need to sit down with a 'C' textbook to learn the language before you start jumping into AVR stuff.

 

Did anyone mention that this is easier to do on a PC ... ?

 

"F_CPU has to be a constant", no idea what it realy means.

Again, if you click on that message it will take you to the relevant place.

 

It should be clear what it means when you look at that place, and look at the message.

 

We can't explain it to you as we can't see the code!

 

 

 I did try several changes in the C/h- files

Again, randomly hacking about is not a good route to understanding!

 

You need to get that 'C' textbook, and work through it in a logical progression, building new concepts on what you've learned before.

 

https://community.arm.com/develo...

 

 

 

No idea where the previous errors came from.

See above.

 

 

Now I have to go on to get the sample working and get a connection to a terminal software on the PC

No!

 

You really need to spend time on the basic language - so that you're not constantly getting these messages that you don't understand, and don't understand how you fixed them when they "magically" disappear!

 

 

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. Oct 2, 2019 - 10:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
you clearly changed something else as well

I think he's saying that he just threw it all away and started again ?

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

JB57 wrote:
get a connection to a terminal software on the PC via asynchronous serial line, that's the goal of the exercise

If that's the goal of the exercise, why don't you just do it in assembler?

 

If you actually want to learn to program in 'C' - that's a different goal.

 

 

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

Yes I probably did

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

:-)

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

I just mean its the goal for this exercise, next one is comming.

 

Doing it in assembler is nothing new to me. Maybe it turns out to me, that C is not worth it to learn and I stick to assembler. I have an idea for an inteligent charger where a lot of math has to be done and also some funcy display, thats where the motifacion comes from to learn C and also a general interest.

 

regards

 

 

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

JB57 wrote:
that C is not worth it to learn and I stick to assembler.
Seems unlikely - your situation describes almost everyone on this forum. With one or two notable exceptions we've all switched from Asm to C in the last 30..40 years.

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

JB57 wrote:
Maybe it turns out to me, that C is not worth it to learn

If you want to learn 'C', you really need to commit to doing that!

 

Hacking about like this is just going to get you (and us) frustrated.

 

If you want to be a musician, you have to learn your scales.

It's not fun, it won't entertain your friends, and it won't make a hit record - but it is an essential basic skill that you need in order to do those things!

 

So, really, get yourself a 'C' textbook (or some other course of instruction) and work through it methodically.

 

Lay foundations first !

 

Here are some 'C' learning & reference materials for you - including a free online textbook:

 

http://blog.antronics.co.uk/2011...

 

 

 a lot of math has to be done

another example of stuff that's best done on a PC first ...

 

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. Oct 2, 2019 - 11:27 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well,I just started a couple of days ago and I have a good text book about C. In adition I work trough the exercise book with practical hardware examples. Most problems I have with these overwhellming features of the modern development environment.

 

I used to work with MPLAP when it started and it was a fantastic tool for me.

 

I hope you will also help me in the future and if I nerve too much just ignore my questions.

 

regards

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

JB57 wrote:
Most problems I have with these overwhellming features of the modern development environment.

The only reason it seems "overwhelming" is that you're leaping in at the deep end without having properly studied & mastered the basics.

 

All the more reason for starting on a PC !

 

 

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...