problems with the fuses on an atmega8

Go To Last Post
61 posts / 0 new

Pages

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

But I´m learning the arduino language

Which is actually just C++, the more complex version of C. So if C drives you crazy what does C++ do? ;-)

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

 

I didn´t know this fact, hehe

 

Someone encouraged me to use arduino, and told me that the arduino language is not really hard to learn. I believed him and started to learn the commands and writting small sketches. You can soon start doing things with leds, sensors, etc...this is a fact. Now that I´m starting, I don´t think that this is a really difficult thing.

 

In the other side, I´ve always thought that the computer languages are really complex and need full time dedication. I´ve never thought about start learning computer languages, I´ve always thought that´s too much for me...

 

Nevertheless, if you tell me that arduino is C++, of course I have to believe you.

 

And from all of this I can deduce an ending...the power of suggestion is really mighty, :)
 

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

To be honest while it is C++ apart from member functions and over-loading they don't really use any ++ features and it might just as well be plain C. So you have learnt C, well done! 

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

hehe thanks!!

 

I have not learnt, I´m only learning, but thanks for the information, hehehe ;)

 

Amazing!! I had never imagined such that thing.

 

So...the arduino language is the languange used in the .hex files that we burn in the AVRs???

 

really interesting!!!

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

So...the arduino language is the languange used in the .hex files that we burn in the AVRs???

Err no.

 

CPUs just fetch number patterns and some bits set in some of those numbers tell it to perform an operation like an add, shift or jump.

 

That sequence of numbers (opcodes) is encoded into ASCII using Intel Hex format in .hex file just because it makes the numbers easier to see, study and email (which was the original reason for these ASCII formats that hold binary number values). But hex is still just a block of number patterns for the CPU. In no way is it a "language".

 

The first hint of a "language" is one step above the number patterns. The silicon vendor (Atmel in this case) gave each of the number patterns a helpful, human readable name to make it easier for humans to understand. So the number 0x0C73 which tells the CPU to add the contents of R7 and R3 and put the result in R7 is given the "name" ADD R7,R3. Now that is is a language. It's assembler. But in the .hex file it's just 730C and nothing more.

 

A level above this is C where you may have written:

a = a + b;

and the compiler turned this into something like:

LD R7, Y+1
LD R3, Y+2
ADD R7, R3

and as well as the opcodes for the two LD's the ADD here is what generated the 0x0C73. Again C is a "language" - a set of words that you the human understand that let you put down in words what you'd like to achieve (in this case add 'b' onto 'a'). Arduino or C++ or C then just take these words and structures in that well defined language and use them to generate another language: Asm. Then the assembler reads that language and just converts it into a load of 16 bit numbers and that's what is in the .hex file and ultimately in the flash of the AVR and fetched by its CPU and interpreted as nothing more than bit patterns turning on particular transistor paths. (in this case eight "full adder"s that add the 8 bits in both 'a' and 'b').

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

Hey, thankyou Clawson for such a good explanation!

 

Really interesting.

 

and I suppose that .hex files used in AVRs are usually or always compiled from code written in C.

 

Or maybe they could be written in other languages and compiled into .hex?

 

Regards

 

 

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

Or maybe they could be written in other languages and compiled into .hex?

Yes, compilation from any language results in hex file.

 

From a hex file you cannot recognize the used language and it is not important at all.

Even if you knew it was C language, in no way you can reconstruct the original C code from the hex file (If you mean this).

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

Thanks Visovian.

 

I understand now many things, :)

 

For ex. the importance of the source code for everything, hehe

 

 

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

From a hex file you cannot recognize the used language and it is not important at all.

Actually you kind of can. If you take a .hex file and run it through a disassembler then if you find it always using the same registers (and order) to pass values to functions then, in those functions, creating space on a stack somewhere for local variables it's a pretty fair bet you are looking at code that originally came from a C compiler.

 

When you first look at disassembled C code your first thought is often "why on earth are they doing things like that?".

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

Now that is is a language. It's assembler. ...

I thought that foul language was discouraged on the new, kinder, 'Freaks.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Pages