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.

Starting with Microcontrollers

Status
Not open for further replies.
I want to start learning and using microcontrollers.

I've a few questions before starting:

  1. What microcontroller should I be using ? I've seen people everywhere recommend either PIC or AVR... My own friends in the field are divided between fanboys of each so none of them give unbiased answers.
  2. If it helps, I know C programming pretty well. Is it alone enough for microcontroller programming or do I need to learn assembler ?
  3. Since C is a standardized language, is it the same for all types of microcontrollers ? If not where does it differ ?
  4. I use Linux, not windows. Are both PIC and AVR well supported there ?
  5. Other than the two above mentioned architectures, what other options do I have ?
  6. Which of the two is the most general purpose ?
 
1. The biggest decider I find in whether to use any microcontroller is the availability and cost of the development tools (programminghardware and software). If you aren't completely clueless about how things the concept of how to program a microcontroller (coniguration registers and such) and can handle SMD components, I actually think it might be best to go with ARM Cortex M3. THe programming hardware is cheap and the compilers can be cheap or free, and it gives a lot more headroom to grow in since there are much more powerful ARM processors out there.

2. I don't think you need to know assembler...it certainly helps though because it teaches you how the registers have to be manipulated and how things work in the background which can increase the efficiency of your programming.

3. It's basically the same but not all things are supported by every compiler. THe largest variation will be the configuration registers and how they have to bet set up. But that doesn't realy count as part of the programming language itself.

4. I think they are, but I don't use Linux.

5. As I mentioned earlier, ARM.

6. Neither and both. It's like asking what car is better suited for a general use? A Honda or Ford?
 
Last edited:
Both AVRs and PICs will serve you well.

The last time I checked the programming tools for PICs on linux were not too great. That alone would suggest you go with AVR.

C standards do not cover microcontroller related issues. Processor configurations and device/port names vary be compiler vendor and processor core.




I want to start learning and using microcontrollers.

I've a few questions before starting:


  1. What microcontroller should I be using ? I've seen people everywhere recommend either PIC or AVR... My own friends in the field are divided between fanboys of each so none of them give unbiased answers.
  2. If it helps, I know C programming pretty well. Is it alone enough for microcontroller programming or do I need to learn assembler ?
  3. Since C is a standardized language, is it the same for all types of microcontrollers ? If not where does it differ ?
  4. I use Linux, not windows. Are both PIC and AVR well supported there ?
  5. Other than the two above mentioned architectures, what other options do I have ?
  6. Which of the two is the most general purpose ?
 
1. The biggest decider I find in whether to use any microcontroller is the availability and cost of the development tools (programminghardware and software). If you aren't completely clueless about how things the concept of how to program a microcontroller (coniguration registers and such) and can handle SMD components, I actually think it might be best to go with ARM Cortex M3. THe programming hardware is cheap and the compilers can be cheap or free, and it gives a lot more headroom to grow in since there are much more powerful ARM processors out there.

2. I don't think you need to know assembler...it certainly helps though because it teaches you how the registers have to be manipulated and how things work in the background which can increase the efficiency of your programming.

3. It's basically the same but not all things are supported by every compiler. THe largest variation will be the configuration registers and how they have to bet set up. But that doesn't realy count as part of the programming language itself.

4. I think they are, but I don't use Linux.

5. As I mentioned earlier, ARM.

6. Neither and both. It's like asking what car is better suited for a general use? A Honda or Ford?

ARM ? Now THAT sounds interesting since it scales to higher levels. Can you give me details ?

Is it well supported ? Is it as easy to work with as other microcontrollers ? And more importantly, is it better to use in the long run ?

Both AVRs and PICs will serve you well.

The last time I checked the programming tools for PICs on linux were not too great. That alone would suggest you go with AVR.

C standards do not cover microcontroller related issues. Processor configurations and device/port names vary be compiler vendor and processor core.

As far as "tools" are concerned, the only thing I need is a free, strong, optimized C compiler...
 
ARM processors are one of the more popular ones used in industry. THey are actually a processor core so multiple companies use that core to make the actual ARM processor or microcontroller. So there's more diversity in selection to and they run from microcontrollers up to microprocessors with things like external memory. Two big companies that make them in the the smaller sizes workable by hobbyists are ST and NXP Phillips. Luminary is another one. Companies like TI or Freescale only use the higher end ARM cores which are difficult to work with because of increased complexity, more expensive development tools (both hardware and software) and a scary BGA package.

THere are different ARM cores of different power levels. Development tools tend to be limited to either the lower end or the higher end, not the full spectrum. But there's more familiarity moving from one to the other. The older ARM7 and newer ARM Cortex-M3 are the ones of most interest due to the cost of the part, ease of the IC packages they come in, and availability of development tools. They also tend to be more powerful than PICs, including the ARM7 and ARM Cortex-M3. Unless I am mistaken they are more powerful which isn't suprising since they are all 32-bit and can run at faster clock rates. ARMs can be found in things like I-Pods and Blackberries. The most powerful ARM processors can be usedin things like laptops though you probably won't ever touch one of these. So in my opinion, it is more versatile in the long run.

Be noted that it's not quite as hobbiest friendly as far as examples go, but lots of people out there use them and more and more hobbiysts seem to be using them as well, especially with the release of the Cortex-M3 since it's been designed for microcontrollers, whereas the older ARM7 was actually a processor core that was implemented into a microcontroller. run I think. WHere I was working only the little projects made by summer students to use in-house used PICs. THe "real" products that went out to clients used ARMs.

You get can "brand name" programmers out there for $60 at an educational price. There are others as well, but this is the most "brand name" one I've found. We used them at work. My PIC programmer from Microchip actually cost me $150 but now they also have $50 programmers available. There are also free compilers, but if you want a polished IDE with everything taken cared of for you they can be had for $150 which to me is reasonable considering how much headache I can avoid (dead serious, as a hobbyist I'd pay $300 for that). THe most important thing I have found is to select the right IDE- nothing else is even as remotely important...except for maybe whether or not the chip is in a BGA package or not

https://www.segger.com/cms/j-link-edu.html
https://www.rowley.co.uk/

Some manufacturers also include ARM Cortex-M3 bootloading firmware on their chips so you might not even need a programmer. ST and Luminary are two. NXP might also have it but I didn't check. Sometimes the bootloader is in flash, sometimes it's actually in ROM and is always there no matter how badly you screw up. So you might not even need a programmer module in some cases.

THese starter boards might also be of interest to you if you are looking at ARMs:
https://www.sparkfun.com/commerce/advanced_search_result.php?keywords=ARM&search_section=products

And this one if you want a module to integrate into your projects rather than an entire dev board:
https://www.sparkfun.com/commerce/product_info.php?products_id=8559

YOu should probably download some datasheets and userguides from different PIC, AVR, and manufacturers for ARM (probably ST or NXP) and gloss through them and how to configure the chip and it's registers to see if you somewhat get a grasp of what you have to do at all with each IC.
 
Last edited:
@dknguyen:

Thanks for the reply. Cleared most of the things for me. But yeah, it also raised several new questions.

1. What are the prices for individual ARM microcontrollers ? I mean ones minus the whole board ? I want to try something that will allow me to start on a low budget. I mean something like PIC18 price-wise.

2. Suggest a good IDE for ARM Cortex-M3 development. Arduino seems to have the most attractive IDE and programming language (wiring) option I've ever seen: they are both opensource and easy to use. Considering the fact that ARM is an age old standard, present in any device smaller than a netbook, does it also have a similar support ?

3. Some time later I hope to graduate to embedded linux development. Does the basic structure of hardware remain the same when we move to higher end implementations of ARM ?

EDIT: As a uC to start with, I want something which does the same thing that Python did to programming languages. It should be easy to learn, easy (read: QUICK) to code (since time is money), and it should have a strong community support. At the same time it should also be cheap. If comfort and ease of use mean a tiny drop in performance, I'm ready to live with that as long as there are alternatives to get the job done.
 
Last edited:
The large ST Arm Cortex-M3 100 and 144 pin chips run around $20, at least according to Digikey. THe smaller 36, 48 and 64 pin ones run anywhere from $3 up to $12 depending on memory capacity rather than pin-size. Remember that they are surface mount only- no DIPs if that matters to you.

Yes, a lot of hobbyists do use Arduino because it's programming was made to be user friendly to those unfamiliar with embedded systems. Of course, what you always sacrifice when you do that is versatility and power. In that sense it's different from PIC, AVR, and ARM and so I don't think any bare chip has the same support amateur-support Arduino has. I don't know much about else about Arduino but there are a lot of UAV projects on DIYDrones that use them.

The ARMs are made to be easy to migrate to higher levels. That's one of the reasons people (or rather companies) use them- lots of sources and lots of power levels.

About IDEs, are you talking about free ARM IDEs? I don't really look at those very much unless it's almost immediately obvious to me how to set it up and use it. I'm much more of a hardware guy so all that makefile and configuration stuff is just a giant headache for me. The Rowley Crossworks one I linked to was the one I chose among a number of others with a similar price. CodeSourcery G++ was among the ones I looked at. But they all require some money (from $100-$300) which I deem very acceptable because it saves me a lot of frustration but a lot of people would call that outrageous. The $100 one is one of the CodeSourcery versions if you were wondering but I liked the Rowley Crossworks IDE more. Codesourcery is actually the gcc compiler with the Eclipse IDE with some of their own modifications to both and configured for you. Raisonance is another one that is available both free and paid for ST chips if I remember right.

You should search around a bit. WHat might be totally unacceptable for me seems acceptable to many (if not most) people. If you can set up the the Eclipse IDE with the gcc (or CodeSourcery G++ lite which is their free command-line only compiler) it won't cost you anything.I couldn't figure out how to do that though because like I said- not my thing and I don't have the patience.

From your Python description it sounds like you want something like ARduino. From there you can move one to whatever you like because by then I would think you woudl have a feel to what everyone is talking about here. I started with OOPic R+ personally, and went onto bare PICs one project afterwards. Let me tell you, though there was a lack of versatility with the OOPic because there were no registers to configure, it was a helluva lot faster and straightforward because I could intantiate objects in the code that represented real hardware and those took care of al the nitty gritty. I think ARduino is lower level than an OOPic though so more versatile, powerful, and more in line with the use of bare chips with more complexity.

EDIT: Yeah, I checked around and it seems OOPic is higher level abstraction than Arduino is. Apparently there is Arduino-like PIC system now called the **broken link removed** that uses the dsPIC33F.
 
Last edited:
Am I the only one seeing mixed signals.
As far as "tools" are concerned, the only thing I need is a free, strong, optimized C compiler...

Arduino seems to have the most attractive IDE and programming language (wiring) option I've ever seen:

As a uC to start with, I want something which does the same thing that Python did to programming languages. It should be easy to learn, easy (read: QUICK) to code (since time is money), and it should have a strong community support. At the same time it should also be cheap.
 
Nah, I just thought we convinced him that the choice of IDEs and compilers are very important for embedded. The fact the sescond two quotes coincide with each other to oppose the first, supports that.
 
Last edited:
The large ST Arm Cortex-M3 100 and 144 pin chips run around $20, at least according to Digikey. THe smaller 36, 48 and 64 pin ones run anywhere from $3 up to $12 depending on memory capacity rather than pin-size. Remember that they are surface mount only- no DIPs if that matters to you.

3$ does seem to be a reasonable starting point.
Any links on one of those, as a sample of what I can expect ?

And how is the price-to-performance ratio of the low end ARM Cortex-M3 microcontrollers compared to competition from AVR and PIC ?

Yes, a lot of hobbyists do use Arduino because it's programming was made to be user friendly to those unfamiliar with embedded systems. Of course, what you always sacrifice when you do that is versatility and power. In that sense it's different from PIC, AVR, and ARM and so I don't think any bare chip has the same support amateur-support Arduino has. I don't know much about else about Arduino but there are a lot of UAV projects on DIYDrones that use them.

From your Python description it sounds like you want something like ARduino. From there you can move one to whatever you like because by then I would think you woudl have a feel to what everyone is talking about here. I started with OOPic R+ personally, and went onto bare PICs one project afterwards. Let me tell you, though there was a lack of versatility with the OOPic because there were no registers to configure, it was a helluva lot faster and straightforward because I could intantiate objects in the code that represented real hardware and those took care of al the nitty gritty. I think ARduino is lower level than an OOPic though so more versatile, powerful, and more in line with the use of bare chips with more complexity.

EDIT: Yeah, I checked around and it seems OOPic is higher level abstraction than Arduino is. Apparently there is Arduino-like PIC system now called the **broken link removed** that uses the dsPIC33F.

Yeah but its also outside my budget for an entry level system. Arduino starts at 30$ right ? That's waaaaaay off the mark from the 1-6$ I'm looking at.
 
THe Arduino costs $30 becauset the PCB is taken cared of. You can't really say a a car is too expensive because it costs more than an equivalent mass of raw steel, plastic, and rubber.

ARMs more powerful than most PICs and AVRs without a doubt because they tend to be of newer design, run at faster clocks, and are 32-bit. A majority of PICs and AVRs are 8-bit. Microchip came out with 16-bits chips a few years ago and 32-bit chips more recently. AVR also has 32-bit chips now too. I don't know how long they've had them for though because I don't follow Atmel, much longer than Microchip I think. These 32-bit chips available which are probably on par with the lower level ARMs (they'd have to be to compete). But obviously, the higher level ARMs will outstrip these.

For samples just go onto Digikey, type in whatever you're looking for and select the microcontroller category.
 
Last edited:
The PIC32 bit chips use a MIPS core.
**broken link removed**

They are mostly 80MHz parts and the price for single units range from about $4 to $10 at newark. They are all SMD parts too.

Up to now I have only needed 8 bit parts and am looking for an excuse to use a few of these.
 
Last edited:
My typical excuse is futureproofing. Actually, it's pretty bad lol. I want to use an FPGA to build something that does nothing more than some ADC values and switch states and sends it over a UART. THe only reason I'm going use a tiny 50,000 or 500,000 gate FPGA instead of a 3.4 million gate FPGA is it's in a BGA package (hence professional mounting) and requires a 8-layer PCB (expensive!). THat said, if I ever do get around to making an FPGA module for the 3.4 million gate FPGA, I wouldn't have a second thought about just plugging it in and using that.

You know...expandibility! What if I want to add video processing into it later or do massive digital filtering on the ADC input? And I don't have a feel yet for how much resources a design will take up!
 
Last edited:
I use the 8 bit chips for teaching so I use them for my needs.

The top end 18F PICs are up to 10MHz (real) instructions per second which so far has been enough for me.

When I do make the jump I plan to skip the 16 bit chips.
 
Is there a simple way to interface a small LCD screen with a microcontroller ? I'm looking for a C library to do the work, the way stdout does in vanilla C.
Basically I need to output numbers, words, etc.
 
Is there a simple way to interface a small LCD screen with a microcontroller ? I'm looking for a C library to do the work, the way stdout does in vanilla C.
Basically I need to output numbers, words, etc.

C18 has the xlcd library.
 
A little bit more detail will be appreciated.

I'll mostly be using Atmel AVR 8-bit Microcontrollers (using GCC C compiler) in the beginning. For projects with higher requirements, I guess I'll have to go for 32bit ARM Cortex M3's. And for these, how good are the Atmel ARM products ?

And do any microcontrollers come with onboard lcd interfaces ?
 
Are you talking about LCD character displays or LCD graphic displays ?

Character displays are not hard to work with and can easily be used with most any 8 bit micro controller.

I do not know about atmel but microchip has micro contollers that hook directly to LCD glass (LCD with not controller). But they may all be SMD parts due to the pin count.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top