NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Microcontroller Programming » Anyone know of a good book for a beginner?
March 31, 2012 by Akeshish |
Hi everyone , I was wondering if anyone had any good book recommendations I found this one on Amazon and was wondering if this was a good companion for the nerd kit? Embedded C Programming and the Atmel AVR, 2nd Ed http://www.amazon.com/Embedded-Programming-Atmel-AVR-ebook/dp/B006QH8N96/ref=sr_1_1?ie=UTF8&qid=1333177932&sr=8-1 |
---|---|
March 31, 2012 by JimFrederickson |
I have the "Tiny AVR Microcontroller Projects for the Evil Genius" Book... I am NOT really sure how good it is, but it does have a alot of circuits that work for me to play around with. I like it... I also have "Programming and Customizing the Microcontroller". That was mostly where I started, "at least started a new with Microcontrollers". It does have alot of circuit ideas, but of course the code examples are not useful for the AVR... I really do like the "...Evil Genius Book" though... (there is free shipping from Barns and Noble for order of $25 or more I think...) |
March 31, 2012 by Ralphxyz |
The Embedded C Programming and the Atmel AVR, 2nd Ed gets some great reviews on Amazon. I have spent a small fortune on buying electronics and computer books (I used to spend at least $400.00 month on Amazon). But I have never gotten the kinda information that I could actually use without the support of forums like the Nerdkits and others. Now with google there are so many hands on examples plus you can usually ask questions. I have had very very limited success asking authors questions related to their books or subjects. I did get a reply from Ritchie concerning C though. I also do not know if I have ever had a book where the code examples actually worked beyond the first two or three chapters. So while I have spent a lot on books I have definitely gotten more out of forums for free, of course I have gotten flamed for asking stupid questions on some supposedly "advanced" forums also. Ralph |
March 31, 2012 by Akeshish |
thank you |
September 09, 2012 by jmuthe |
I too am also looking for programming books for beginners but I want to be specific about what I am looking for. I took electronic courses in college and I know the basics of electronics but I am not too good with programming. I know that there are probably plenty of books out there about C programming. However, not all of them are meant to have the user connect to an external microprocessor. I took a brief course in C++ programming in college but when I ran the programs that I created, it didn't control a microporcessor like with the Nerdkit. All the programs did was print out messages on the screen like "Hello World" with cout statements and allow the user to input information in the program with Cin statements. I want a book that teaches a beginner how to use C programming to control a microprocessor. If Akeshish and JimFrederickson have read their books yet, then let me know if they are what I want. If anyone else has a suggestion of a good book then let me know. I am also looking for a book on makefiles and libraries. Although I may have a little knowledge of how to write a program, I still have no idea what makefiles or libaries are in C programming. When I make a programs with the Nerdkit, I have just been copying and pasting the makefiles from the sample programs provided. However, I want to eventually know exactly how to create a makefile from scratch and know what each line on a makefile is doing. Are there any good books out there that will explain to me each portion of a makefile and library? |
September 10, 2012 by Ralphxyz |
Did you know you could commit the rest of your life just to learning Make? To get started do a google of "Make". You probable want to start with Gnu Make. Personally I have different things I can apply myself to learning since copy/paste/modify works so well but reading about all that goes on in using Make is fascinating and while I have never seriously studied it I have gone through the manual. For great C programming go to Smiley's Micro Smiley has courses on C programing and books. Ralph |
December 11, 2012 by jmuthe |
Hey Ralphyz, I wanted to ask a question about your link. When I looked at your link for Smiley's Micro, there was a book called "C Programming Microcontrollers". It comes with a kit but I already have the Nerdkit with a microcontroller and a bunch of different parts so I feel that it might be a little redundant to get another one. I could buy just the book or the book plus the whole kit. Would I learn anything from the book without buying the whole kit or do I have to get the whole kit in order to learn anything? I was hoping to buy the book and then use it with my Nerdit to learn from it. Would that work? |
December 11, 2012 by pcbolt |
jmuthe - It looks like you can just buy the Smiley book for about 1/2 the price of the kit (still a little pricey). There is a link under "C Programming" on the left hand side of the page. Looks more like a project cookbook than a detailed look at programming but it may be just what you need. If I were starting out, I'd get an old used book on programming in C from Amazon ("Teach yourself C" maybe). It's always good to have a language reference nearby. As for compiling and programming for interrupts and microcontrollers, it's hard to find books specific to the equipment you are using or the versions of programs you use like "Make". The best sources of info I have found for that have been on the web or in the NK tutorial section. Ralph is right about "Make". You can get bogged down trying to figure it out. I found the only way to appreciate what "Make" does is to try and compile and link a program step by step from the command line. You may find it easier that way until your programs get more complex. |
December 11, 2012 by pcbolt |
jmuthe - If you want a good reference webpage for C try THIS PAGE. |
December 12, 2012 by Ralphxyz |
I still like Type and Learn C from Amazon for 32 cents for used. It is only about C programming not AVR mcu related. This is for the basics of C programming. Ralph |
December 12, 2012 by jmuthe |
What I am trying to say is that I know that there are many different types of books that explain how to use C programming. However, I would like one that not only teaches how to write C programs, but also teaches how to write C programs to program a microcontroller. Even if I find a good book on C programming and read it, it wouldn't fully help me when I have to program a microcontroller. I suppose I could read the book "Type and Learn C" that Raphjxyz suggested to start off my knowledge of C, but after I read it, what do I do next when I want to actually use it to program a microcontroller? |
December 12, 2012 by JimFrederickson |
I am not sure if there is any single book that is necessarily "best". (But if there IS, I wouldn't mind finding out about it from here or elsewhere. ;) ) Mostly there really are several "disciplines" that intermingled here. (C Programming, Resource Management, Electronic Design, sometimes Signal Analysis/Synthesis, Maybe PCB Design, even just developing habits that make your life easier etc...) I, personally, think that learning C is highly important. I don't think it matters too much where you learn C at/from, but eventually you will have to take into consideration that your target platform has limited resources. (Of course getting a C Book that has an emphasis, or really much of any mention, on graphics programming will not be all that helpful in the end here. ;) ) So perhaps many things that are done on a large platform are best done differently for a Microcontroller. (Even though the same results could be had.) I think multiple books are going to eventually be required to further your knowledge to the level that you want. Understand as well that a specific book may not really work for every person, sometimes just a slightly different perspective can make a world of difference. I have MANY books that really only discuss "one thing" that I find useful to me, but that "one thing" is ONLY in that one book... One such example of this is the "floating point library for Math". That library is fairly large, and for most things it is not really necessary. So not using Floating point numbers can save quite alot of program space. Using the Tutorials from the Nerdkit site an go along ways in furthering your knowledge as well. Their Tutorials are quite well done, and often very interesting as well. Their Tutorials span a large range of Microcontroller circuit design and programming. I have found that going over Tutorials, Circuits and Code to be very instructive over time. One thing I have been a huge proponent of and would "HIGHLY RECOMMEND" is to make sure that you have some "core Microcontroller Hardware" that is soldered. If you read the forums much you will find NUMEROUS EXAMPLES of people having problems with their projects and the problems end up having nothing to do with what they really are working on, but the problem is rather with their core Microcontroller Hardware. The "core Microcontroller Hardware" doesn't really change from Project to Project. There are certain things that you absolutely have that are the same over and over again (Power, Clock, Programmer Communications, etc. ) In regards to creating this "core Microcontroller Hardware" I think it should be just the "basic things necessary". That way the core can be integrated into ANY BREADBOARDING project that you would have. Spending hours debugging some Project Circuit you are working on I think is Productive. Spending hours debugging some problem with your "core Microcontroller Hardware" you are using in some Project I don't think is Productive or even something that should EVER need to occur. |
December 12, 2012 by Noter |
Once you have a working knowledge of C you go to the datasheet of the particular mcu you are working with and use the information found there to program the chip. Programming in C is not different between microcontrollers and other applications, it's the same old C. And once you get to know a family of microcontrollers like the Atmega's you can skip from one to the other and keep most of your code common between them. Sometimes though it is not so easy to understand what is presented in the datasheet and how to go about using a particular feature even if you are well versed in C. My experience is the best answers to those types of questions are found online in forums. The Nerdkits forum is particularly good for beginners. |
December 12, 2012 by jmuthe |
Okay, I guess Noter's answer makes sense. I will first learn as much as I can about the C program itself. Then I'll use the Mictrocontroller datasheet to figure out how to use C program to program that chip specifically. If I want to program a new chip I'll read a new datasheet and if I have any questions I'll use the forum. Thanks. |
December 12, 2012 by pcbolt |
jmuthe - I don't know if the book you describe actually exists. Once you learn the basics of C, the application to microcontrollers isn't that far of a jump. The first difference between running a C program on a PC and the MCU is that you can't let the MCU program end. Therefore you need to keep a loop going in your code. Second, you need to be able to read and write values to the port pins. Third, you should get a basic knowledge of some of the internal registers of the MCU and what sub-functions of the chip they control. Once you get a mastery of that, you can move on to interrupts, timers, analog to digital converters, UART, SPI, PWM, I2C and EEPROM memory. Between the NK guide, the NK tutorial code (recommend you download source code files even if you don't build the projects), and the ATmega 168 datasheet, all the info is there to get you going. Start by building a project to test and explore each aspect of the MCU one at a time. You'll be a master in no time. If you have questions or want to see if you can optimize C code, just post it here and I'm sure several people would want to help. Other than that, I guess the Smiley book Ralph posted would do the job, but from reading the first 3 chapters online, you'd have to make some small adjustments to get the NK to work. For example, he has his own versions of "delay_ms()" you'd have to link to and doesn't seem to like using the "PORTB |= (1<<PB3)" approach. |
December 12, 2012 by pcbolt |
Sorry if I'm redundant, jmuthe. You, Jim and Noter all posted while I was composing my post :-) |
Please log in to post a reply.
Did you know that electric fields behave differently in different materials? Learn more...
|