Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

C' sources to learn the code

Status
Not open for further replies.

bryan1

Well-Known Member
Hi Guy's,

Well with my job being so demanding my time spending triyng to learn C for the pic hasn't been easy. So could you guys provide a good source for learning C. Ever site I look at seems to think you know about it.

Regards Bryan
 
Hi Bryan,

Have a read of this pdf and see if it makes sense. It's hard to judge whether it is good or not as I already know it.

A good way to learn is to just play with example code. What hardware do you have available? I may have some code lying around you could play with.

Mike.
 
Bryan,
It looks good to me. It provides a foundation, while quickly rewarding the student with encouraging examples.
-Mike
 
Do you already know the basics of programming in C? If not you're approaching it from the wrong angle. Try learning a basic ANSI C language for the PC first, just basic text in text out processing using C, there is a HUGE amount of information out there for learning basic C on a PC architecture. If you DO know C then the first thing you should do is study up on the hardware architecture of the PIC series you're using and learn basic assembly for it. You don't need to delve into advanced bit processing or how to code math routines as C takes care of that for you which is what it's there for, but the basic underlaying way you talk to the micro processor is going to look very similar in C vs ASM as far as using hardware features and manipulating I/O lines.
 
I'm learning it from Wilmshursts' book 'Designing embedded systems with PIC microcontrollers.' Chapters 14 onwards deals with C (specifically using the C18 compiler in MPLAB). I haven't done a broad survey, but this is proving to be one of the finest pedagogical books I've read.
 
Do you already know the basics of programming in C? If not you're approaching it from the wrong angle. Try learning a basic ANSI C language for the PC first, just basic text in text out processing using C, there is a HUGE amount of information out there for learning basic C on a PC architecture. If you DO know C then the first thing you should do is study up on the hardware architecture of the PIC series you're using and learn basic assembly for it. You don't need to delve into advanced bit processing or how to code math routines as C takes care of that for you which is what it's there for, but the basic underlaying way you talk to the micro processor is going to look very similar in C vs ASM as far as using hardware features and manipulating I/O lines.

This is a really good point, and I agree! :)
 
Sounds like a good book, but it will NOT replace a fundamental understanding of ANSI C before hand, and ANSI C is a LOT easier to wrap your mind around than micro controller based C languages are to start with. Primarily because the differences are in the hardware addressing and control.
If you want to program micro controllers in C.

Step 1) Learn basic ANSI C (Try LCCWin32 for windows users it's an ANSI C compiler with a few refinements/differences from ANSI C and it's VERY well documented. You only need do some basic console programs which require only basic structural and syntax knowledge and have plenty of examples.
Step 2) Familiarize yourself with the hardware and architecture of the micro controller in question and how it's C variant will alter otherwise ANSI C code, mainly in the hardware / IO department. The easiest way to do this is learn basic assembly language and how the registers/io ports and hardware works.
Step 3) Combine those together and then you'll understand a micro controller based C language.

If you read a book (no matter how good) about MCU programming in C it's going to miss either some of the basic fundamentals of C or some of the strengths of ASM for the particular architecture.
 
I agree that it looks like a good book (from a quick skim) but I also agree with Sceadwian: I'd recommend learning C itself without worrying about architecture-specific issues to start with. Once you have a grip of the language, it becomes easier to understand what's going on when you do get into addressing the hardware and using architecture-specific compilers.


Torben
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top