Good Book to use for Learning Barebones Programming

Hi all, I am of the opinion that learning with a solid foundation is the best way to start coding and to that end was wondering if anybody knew of good resources for a beginner to start learning pure C++ (or AVR C? Not sure which is which). For example, instead of using digitalRead or digitalWrite to blink an LED, I want to learn direct port manipulation and use DDRB and PORTB. I realize that I can see the code behind functions like digitalRead but I looked at it and found it hard to follow. As I understand it, it is all the same language anyway, and what knowledge I learn can be applied to different microcontrollers. Can anybody help?

My apologies if this is in the wrong section!! I feel like it should be in the Education section but now don't know how to move it or delete the thread

Learning C++ and learning to become proficient with the internal mechanisms of a CPU are completely different scenarios.

Using the bare registers is not purer C++ than calling a function wrapping the same functionality.

I am of the opinion that learning with a solid foundation is the best way to start coding

Solid foundation in what, C++, or a particular architecture?

If you are after a good C++ background, then stick to the Arduino API, it will allow you to focus your attention on the pure C++, even the little AVR comes with a learning curve which is something that will be better understood once you can utilize the language.

If you are after a strong AVR background you could even use assembler and avoid C++ altogether. Then you are as close to the metal as you can get, writing out instructions one after the other, and is pretty much 0% portable (apart from the knowledge of how to program ASM, everything else is quite specific to the architecture).

Of course things like communication technologies are similar due to protocols, however the hardware implementations of these can vary considerably between processors. Even in the Arduino world there is a staggering difference in implementation between the Arduino Uno and Arduino Due processors.

As for the books, save your money if you're after a C++ book, there is usually far better information freely available online, like Cplusplus.com / C++FAQ's / Bjarne Stroustrup's site / C++ Standard

There are many Arduino books available, and I'm sure some of the authors on this forum will wander by and mention them. You are also on one of the biggest Arduino resources.

The best teacher is never a book though, its yourself.

  • Write code, discover problems, research a solution.
  • Read code others write, try and apply it to your own code (not copying).
  • Reinvent the wheel to prove what you know and reinforce what you have learnt. *Repeat (most important)

Besides a book you should spend time checking the Arduino site better. Port manipulation is covered on the Playground and in the forum and archives. Just type port manipulation in the site SEARCH.

There's literally 100's of topics covered just in the Playground. All you need to do is look and sometimes search.

pYro_65: Learning C++ and learning to become proficient with the internal mechanisms of a CPU are completely different scenarios.

Using the bare registers is not purer C++ than calling a function wrapping the same functionality.

Solid foundation in what, C++, or a particular architecture?

If you are after a good C++ background, then stick to the Arduino API, it will allow you to focus your attention on the pure C++, even the little AVR comes with a learning curve which is something that will be better understood once you can utilize the language.

If you are after a strong AVR background you could even use assembler and avoid C++ altogether. Then you are as close to the metal as you can get, writing out instructions one after the other, and is pretty much 0% portable (apart from the knowledge of how to program ASM, everything else is quite specific to the architecture).

Of course things like communication technologies are similar due to protocols, however the hardware implementations of these can vary considerably between processors. Even in the Arduino world there is a staggering difference in implementation between the Arduino Uno and Arduino Due processors.

As for the books, save your money if you're after a C++ book, there is usually far better information freely available online, like Cplusplus.com / C++FAQ's / Bjarne Stroustrup's site / C++ Standard

There are many Arduino books available, and I'm sure some of the authors on this forum will wander by and mention them. You are also on one of the biggest Arduino resources.

The best teacher is never a book though, its yourself.

  • Write code, discover problems, research a solution.
  • Read code others write, try and apply it to your own code (not copying).
  • Reinvent the wheel to prove what you know and reinforce what you have learnt. *Repeat (most important)

Thank you very much for such an excellent answer. I was strugling to understand how to approach AVR programming. I became fairly comfortable in wiring language, I don't know it all, but feel comfortalbe. I created many projects with attiny chips and successfuly programmed them from the Arduino IDE without problems. I've learned a little about fuses and other things. However when I bought attiny1634 and tried to program these ICs, I realized that I don't know how to analogRead them. There is no info on arduino.cc about those ICs, just few pieces of info here and there. Because of this, I realized that I need deeper understanding of AVR uCs. I've got my answer from your post even without asking it ;-) about learning C and C++, but how may I approach learning AVR controllers? When I read datasheets, it scares me ;-) I'm not lazy and I'm willing to learn no matter how difficult it may be. I just need someones direction. If you have any ideas, please share. Thank you in advance. Vlad