Tutorial :C Training on 16-bit microcontrollers [closed]


My company is transitioning from assembly coded microcontrollers to C. We are considering Microchip, Atmel, Renasas, et. al. for future projects using C code. Are there good training resources to bring our engineers up to speed with C? Seminars, instructors, classes, etc. The experience level of the engineers varies from no training to some knowledge.


Welcome to the 80's. :) Start with the either classic K&R C book or my favorite C: a Reference Manual by Harbinson & Steel if you can find one. I work with PICs and there are several useful books about PIC programming. I was already familiar with C from using PCs I didn't find them useful in that regard.

C allows you to be close to assembly and most compilers to include it inline, so it's as close to assembler as any high level language. You should happy and at home pretty quickly, I think.

If you are interested in jumping forward a few decades ;>) you might want to consider a Microchip C complier. I'm going to be looking into this soon and there is a good book on Practical Statecharts in C/C++.


The good news is that if your engineers have a background in assembly, some of the 'C' langugage concepts, such as pointers and arrays, will not be difficult to grasp (and hopefully master.)

Regarding your specific question about embedded C training, Netrino has a bunch of courses on embedded training, including writing embedded code in C and C++.

Also, the Embedded Systems Conferences (just had one in Boston a couple weeks ago, next one is in Silicon Valley next spring I think) are always full of courses on embedded development & different languages. But you probably don't have the luxury of waiting 6 months.

If your staff are more of the "book learner" types, these books might be of interest:

That should give you enough to chew on for a little while.


To get started I'd suggest MPLAB from Microchip and the "Student" version of the C Compiler.

The C Compiler runs without optimizations after the expiration period.

MPLAB has a built-in simulator to run the programs. You can bit-twiddle output pins to see things move.


Definitely, you should check http://arduino.cc :




Why do you mention 16-bit?

If it is because you think 8-bit is so 20th century, you're right. But so is 16-bit. Today's 32-bit controllers (esp. ARM) are more powerful and often cheaper than 16-bit controllers. Cheaper because some 16-bitters use outdated processes, with large feature size and hence larger dies.

Actually I think some 8-bit controllers will have a longer lifetime than their 16-bit counterparts. An advantage of the former over 16 or 32-bit controllers may be size. There's no way you can put an ARM controller in a 2.9x1.3 mm SOT23 package. Also the smaller 8-bit controllers are still cheaper than the smallest ARM.

For me the only reason to use 16-bit controllers would be installed code, but since you mention some brands you're "considering", I presume you're not using them at this moment.

I would take a look at ARM. ARM7TDMI is stable and available in a multitude of configurations from several suppliers. I can recommend NXP LPC2000. Starts at about USD 1.50, not bad for a 32-bit controller.


Are there good training resources to bring our engineers up to speed with C?

For starters, a very good and also pretty complete introduction to the C family of programming languages is provided for free by Bruce Eckel's "Thinking in C" multimedia course (the download is about 100 megs in size, and the course itself is in flash).


The msp430 is one of the best micros for C. But your best bet is just go with ARM, they will erase the remaining competition soon. Microchip has grabbed a 32 bit core to compete but I think they will end up being an also-ran. With 32 bit ARMs meeting and beating the price of the tired 8 bit micros (like the PIC and 8051 and z80), other than the msp you should avoid stopping at anything below a 32 bit core.

It is not the best nor most efficient compiler but the price is right and no other compiler has as much support as gcc. It is relatively easy to build or download a pre-built gcc for a number of platforms. I would avoid getting sucked into anything that requires the manufacturers IDE and tools. Those tools are fine and in some cases required to get started with a micro but in the long run you may want to explore the pros and cons of the alternatives.

As for learning C, well if you know assembler than any other language including assembler is just syntax. I am sure everything you need you can find online with google. Once you pick an eval board and a micro (stellaris has some good stuff), start by studying their example programs, then use google to find other example programs and go from there. Particularly with micro controllers, but in general, you want to avoid the gee whiz features of any language, stick with the simple, basic stuff, the stuff that is the same in any programming language. The compilers you experience, esp the purpose built compilers for a micro, are not going to handle the corner cases like say a gcc or microsoft or borland. This will also make your code more portable to take to other micros or other languages (I would avoid anything above asm and C though, esp for micros). If you have to have a book, get K&R or whatever is being used as its replacement. Note that K&R C, straight out of the first edition book, wont really compile anywhere. But it keeps to the basics and keeps you away from the problem areas of the language.

Linux device drivers are extremely high level (almost at the application level, the bulk of the code has nothing to do with "the metal"). You are not going to be running linux on a micro, even an arm micro, learning linux device drivers is a good exercise for other goals but not for this one. You want to avoid the operating system at all costs specifically linux and windows, you want to learn non-operating-system C programming. Look at the WINARM examples. (this includes RTOSes).


For 16-bit Microchip pics, there is


IIRC it was decent, but they focus pretty heavily on doing one thing per chip. Our apps multiplex a lot of I/O, and for that the examples/casestudies in the book (that assumed exclusive use) were hard to bring to practice.

When I started with this architecture, having a readily made example board (from Microchip, $50-$100 range) really helped, specially if you target roughly the same variant as the example board.

This because it offered an easy check if a problem was hardware or software related by running it on the example board.


There are companies that specialise in teaching C for embedded systems, such as Feabhas in the UK, or Netrino in the US. Have a look around the web.

In addition to the processors mentioned in other posts, the STM32 family from ST is well worth a look. They're 32-bit, extremely cost-effective, and come in a large variety of packages.

ST appear to be making a real effort to get people up and running quickly with their product, coming up with development hardware like the STM32 Circle.


The first thing that comes to mind is documentation on writing Linux device drivers. This is loosely related to what you're interested, but coding for 16 bit devices is covered in this O'Reilly book on driver programming. In general, there should at least be a number of useful coding style conventions around.


There are many books on learning C programming, especially for the architectures you mention. Check out amazon with searches for "microcontroller".

Also, Microchip has a lot of seminars/classes for their particular compilers and chips - they are usually inexpensive, and there are several training centers around the US. With many engineers needing to be trained you might consider contacting Microchip directly and seeing what it would cost to have in house training.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »