Best place to learn C

Thread Starter

Guinness

Joined Dec 31, 2009
81
Hi,

as the title suggests, im looking for the best way to teach myself C programming.

Basically which book/books would be the best for me to learn from, aswell as free compilers and stuff.

I recently started bringing pics into my electronic designs and started to learn assembly, I tried to learn C about 10 years ago from a very rubbish company ( who now gets slated all over the internet for being rubbish), shame I didnt know that back then.

It put me off learning C for a long time, but I want to get back into it, rather than assembly being my main language.

If you could suggest some books or webistes I could start from, I have pickit 2, but as far as I know, I still need an external compiler? Also what would be an ok text editor for C.

Cheers
 

t06afre

Joined May 11, 2009
5,934
The Hi-tech C compiler from Htsoft is free in the lite version. Use this for the PIC uC work. This C compiler will integrate into MPLAB. Last week I asked the same question as you but did not get any response. Link here http://forum.allaboutcircuits.com/showthread.php?t=33099
After some Googling and trips to the library. I am evaluating these books.
  • "Beginner's Guide To Embedded C Programming: Using The Pic Microcontroller And The Hitech Picc-Lite C Compiler" I do not have it but it looks nice
  • Beginning C: From Novice to Professional, Fourth Edition Copyright © 2006 by Ivor Horton. Looks very good. Found it in the library.
  • Embedded-C-Programming-Microchip-PIC by Richard H. Barnett, Sarah Cox, and Larry O'Cull. This book use the CCS-PICC C compiler. And the uCs used in the book should be replaced by newer variants. But looks OK
  • C Programming Language (2nd Edition) by Brian W. Kernighan and Dennis M. Ritchie. This is an old classic
  • http://www.mikroe.com/en/books/pic-books/mikroc/ch1/ free but OK
 

Thread Starter

Guinness

Joined Dec 31, 2009
81
Thanks a lot, I will start hunting down which ones I can find.

I had forgot about the Hi-tech C compiler, cheers for reminding me.

I might even dig out my old course material and compare it, just to see how bad it was. I remember a few of the programs in there didn't even work lol

Thanks again for the info, now I have somewhere to start.
 

t06afre

Joined May 11, 2009
5,934
I also forget to mention that microchip do have some C lessons, but then you can not use the 16f690, and the low pin count demo board. However it is no problem to breadboard your own trainer. As the microchip demo board is very simple. They are just some LEDs, simple switch(s) and a pot. Microchip provides schematics for all the demo board. Even if you have a PICkit 2, you can use the PICkit 3 debug express lessons. http://www.microchip.com/stellent/i...deId=1406&dDocName=en538340&redirects=pickit3 The PICkit 2 can use the PIC18F45k20 at least after a firmware uppgrade. You find it here http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en023805
 

delmasli

Joined Sep 17, 2009
17
Hi,

as the title suggests, im looking for the best way to teach myself C programming.

Basically which book/books would be the best for me to learn from, aswell as free compilers and stuff.

I recently started bringing pics into my electronic designs and started to learn assembly, I tried to learn C about 10 years ago from a very rubbish company ( who now gets slated all over the internet for being rubbish), shame I didnt know that back then.

It put me off learning C for a long time, but I want to get back into it, rather than assembly being my main language.

If you could suggest some books or webistes I could start from, I have pickit 2, but as far as I know, I still need an external compiler? Also what would be an ok text editor for C.

Cheers



Addison Wesley (publishing house) books can be prefered. I red some technical books (very well) from this publisher. I know question is about C but I'll tell about C++ book. One of a good C++ programmer named Stan Lippman published a book some years ago. I improved my C++ skills by his book of "Essential C++". As you know C and C++ are different languages but syntax's are same. By using a c++ compiler (such as codeblocks) you can improve your programming skills. It is not so hard to apply these C++ technics to C.
 

Thread Starter

Guinness

Joined Dec 31, 2009
81
microchip do have some C lessons, but then you can not use the 16f690
I just noticed after looking for the header file, there seems to be a lot of pics that can't be used. Is it because its the free lite version and they don't include all header files or is it just a downfall of using hi-tech C compiler?

and the low pin count demo board.
Thats not a prob, I have made a few demo boards allready using stripboard, for the pics that the low pin count demo board don't fit on.

Addison Wesley (publishing house) books can be prefered. I red some technical books (very well) from this publisher. I know question is about C but I'll tell about C++ book. One of a good C++ programmer named Stan Lippman published a book some years ago. I improved my C++ skills by his book of "Essential C++". As you know C and C++ are different languages but syntax's are same. By using a c++ compiler (such as codeblocks) you can improve your programming skills. It is not so hard to apply these C++ technics to C
Cheers for the info, I am going to concentrate on just C for now. But I was thinking of learning C++ in a year or two aswell. Will keep this info for when I do.


Edit: I found the header file for the 16f690, some of the header files once you open them have a short list of pics they are used for. Mine was in pic16f685.
 
Last edited:

t06afre

Joined May 11, 2009
5,934
Yes that is correct. The C compiler don't have a include file for every CPU. I was struggling a bit with this, because of the config bits setting. I did not know the naming convention. I had to do a search in the header files to solve it ;)
 

maxpower097

Joined Feb 20, 2009
816
There are lots of beginner books on C you can find. All of them are pretty good but for something different if your a true beginner look at VTC's C training discs. They have 2 of them and they are pretty basic and easy to follow. Watch them, then start reading books. Also C and Embedded C are two different things. The embedded C's usually follow the same rules as standard C but they have a bunch of support libraries that support only the chips they support.
 

ELECTRONERD

Joined May 26, 2009
1,147
I'm trying to learn C as well, but I need a good reference. I have just started reading "C for Dummies," but it doesn't apply to programming electronics with C. Any excellent online links or references would be appreciated!

@t06afre: Of those books you suggested, which one do you think would be the best to read?

Austin
 

t06afre

Joined May 11, 2009
5,934
HI Electronerd
Have you selected which MCU brand you will go for, and what kind of MCU development system will you select
 

t06afre

Joined May 11, 2009
5,934
Yes, I've just recently requested the PICKit2. I will be using the
PIC18F1320.

Austin
A very promising book is the "Beginner's Guide To Embedded C Programming: Using The Pic Microcontroller And The Hitech Picc-Lite C Compiler", as it combine both C and Microchip MCUs. I have not read it I must admit. You will find both "Beginning C: From Novice to Professional, Fourth Edition Copyright © 2006 by Ivor Horton", but "C Programming Language Brian W. Kernighan" is also a good book. Microchip do also have some free lessons see one of postings in this thread for link. You can easy bread board the demo board that is used in those lessons. And all needed software can be downloaded.
 

t06afre

Joined May 11, 2009
5,934
I will look into it, thank you!

Austin
Sorry but a few word got lost in my last posting. But anyway You will find both "Beginning C: From Novice to Professional, Fourth Edition Copyright © 2006 by Ivor Horton", on Google books. And I am sure you will find "C Programming Language Brian W. Kernighan" in the library as it is a classic.
 

bluebrakes

Joined Oct 17, 2009
252
I find it difficult to learn from books... I only use them as references.

The best way i found was simply trial and error in the programming interface.
What works and why not... etc.

read an example piece of code... play about with it. see what changes and why did it change.
 

t06afre

Joined May 11, 2009
5,934
I find it difficult to learn from books... I only use them as references.

The best way i found was simply trial and error in the programming interface.
What works and why not... etc.

read an example piece of code... play about with it. see what changes and why did it change.
Oh yes! If you want to learn how swim. You have to get wet. Also remember that the debugging tools are your best friend.
 

Tahmid

Joined Jul 2, 2008
343
Hi,
From my experience, I find mikroC to be the best C compiler. It has awesome library functions and a nice IDE. They have a free version limited to 2k program word, but no time limit.
You could give it a try.
www.mikroe.com
Hope this helps.
Tahmid.
 
Top