Beginner tutorials/Projects..

Thread Starter

buddyboy

Joined Aug 5, 2016
2
Dear all,

I have an ATmega328p as my microcontroller of choice. I am not a newbie when it comes to electronics but my embedded knowledge is not great at all. But, the only thing I have done so far is blink an LED, in GCC C programming language within Atmel Studio 7.

I cannot find any beginner tutorials or projects that progress on from this? I have done a lot of reading around and stuff, but I am kinda stuck on what the next step should be.. :S What fundamentals should I be looking at? what documentation or registers should I be focusing on? :S Should I follow the basic Arduino examples and try to do that in C? what? Oww, any help would be handy..
 

DickCappels

Joined Aug 21, 2008
10,179
If you are serious about learning to program as a skill, as opposed to merely using a controller to make your project work, stick with C and/or assembly.

The book below got me started quickly and I recommend it. Of course having a friend who is a C programmer helped a lot too. The book contains several projects and demonstrations as well as explaining some of how C works.

https://www.amazon.com/Programming-...rds=C+programming+for+microcontrollers+pardue
 

vead

Joined Nov 24, 2011
629
Dear all,

I have an ATmega328p as my microcontroller of choice. I am not a newbie when it comes to electronics but my embedded knowledge is not great at all. But, the only thing I have done so far is blink an LED, in GCC C programming language within Atmel Studio 7.

I cannot find any beginner tutorials or projects that progress on from this? I have done a lot of reading around and stuff, but I am kinda stuck on what the next ..
I think reading is not enough, if you really want to learn something, than you have to do a real work, as you said you are familiar with microcontroller, you can write code, you know the compiler, so do some practical, if you did the led project then, try to led on off using switch, buy lcd display, write some code to display your name, and if you can see your name then write program for scrolling message, so you can write code for different purpose,
 

bug13

Joined Feb 13, 2012
2,002
Read the datasheet of the device and the gcc user guide, then try out all the functions/peripherals one by one, eg timers, ADCs, comparators, USARTs, SPI, I2C, different power management mode, different type of interrupts, clock source, eeprom, watchdog timer, this will give you busy for a while.
 

Willen

Joined Nov 13, 2015
333
the most authoritative document on that is the device datasheet.
Datasheet of an simpler AVR microcontroller is bigger than a bigger novel. 8 pin controller has a datasheet which has more than 300 pages. Also these are pretty good for engineers but not good for beginners (like me). They describe chemistry/physics behind their registry. But it's not beginning information for me. I need to search What is registry, how they work, how I can get work from it, how to address them.......... So beginning is more complicated than learning advance. :)
 

bug13

Joined Feb 13, 2012
2,002
Datasheet of an simpler AVR microcontroller is bigger than a bigger novel. 8 pin controller has a datasheet which has more than 300 pages. Also these are pretty good for engineers but not good for beginners (like me). They describe chemistry/physics behind their registry. But it's not beginning information for me. I need to search What is registry, how they work, how I can get work from it, how to address them.......... So beginning is more complicated than learning advance. :)
Think of registers as dip switches of the MCU, you set the individual bit to on/off position to change the setting of a device. Same as MCU, you set the individual bit of the register to 1/0 to change the setting of the MCU.

In the datasheet, it will tell you what the MCU does if you set 1 bit to 1/0.

For example (in AVR, GCC complier) set bit to 1:
Code:
REG_A  = REG_A | (1<<BIT_NAME_OF_THIS_REG_YOU_WANT_TO_SET);
This is a good site to learn about AVR:
http://www.avrfreaks.net/forums/tutorials
 

NorthGuy

Joined Jun 28, 2014
611
Also these are pretty good for engineers but not good for beginners (like me).
Do you think professionals have their own "hard" way of doing this. No. It's the same whether you're an amateur or professional. The only difference is that good professionals know that it's better to spend time understanding datasheets (no matter how long it takes) than waste much more time trying to do things which they don't understand. Amateurs, on the other hand, believe that there's a magical way of doing things which doesn't require prior understanding. Rather than reading datasheets, they better spend days banging their heads against the wall trying to find a quick solution.
 

Willen

Joined Nov 13, 2015
333
Amateurs, on the other hand, believe that there's a magical way of doing things.
Hi, Being a teacher in a school, I have been taught to teach in class from simple to hard. So I used to think that the datasheet is 2nd step to start reading. Because when I was learning about ohms law, I didn't understand transistor's datasheet. But in the case of microcontroller, I found the datasheet has many more useful information for beginner too. So struggling to be a general user of programming and controllers. :)
 

NorthGuy

Joined Jun 28, 2014
611
I agree that the transistor datasheets are somehow difficult to the beginner, but even if you're building a simple relay driver you do need to read something from the transistor datasheet, such as maximum current. If you're building a high power inverter, then you better be at the level where you can understand all the relevant details - you don't want to pay $200 for a wrong transistor, and you sure don't want to die when it shorts.

MCU datasheets are much easier in this respect as they don't require much prior knowledge except for some common things such as "pull-up", "open drain" etc. But you should know about these things before you start, and if you don't, you go to the Internet, type what you want to know and read about it. Say, you don't know what is open drain, you type "open drain" in Google and voila:

https://en.wikipedia.org/wiki/Open_collector
 
Top