Author Topic: Simple Microcontroller for a beginner  (Read 30481 times)

0 Members and 1 Guest are viewing this topic.

Offline 8086

  • Super Contributor
  • ***
  • Posts: 1084
  • Country: gb
    • Circuitology - Electronics Assembly
Re: Simple Microcontroller for a beginner
« Reply #25 on: February 22, 2012, 04:56:50 am »
That is unless you write for PICs using the various PICBasics out there or any other abstraction layer.  :)   It will always be up to the person if they wish to learn the low level of anything.  Abstractions layers will continue to exist.  Otherwise, we will refuse anyone from writing micro code in C and insist on Assembly only!  ;)

I personally love to hook up my Arduino Uno when I'm writing some code in C for AVRStudio 4.  It is all what you take from it.  I like a USB based test platform that is really cheap.  I've found AVR assembly to be much nicer than PIC assembly, when working on some of the ATTiny chips and I'm not allowed the C abstraction layer.

Indeed, however to get the best understanding of the device, you would use assembly, and if you're using assembly, why not use PICs? The Arduino 'advantage' is gone unless you stick with the system you're expected to use.

Let's face it, if you're getting an Arduino, you're not going to use assembly.

But hey, maybe I'm ever so slightly biased from having 99% of my successes with microcontrollers using PICs and assembly code.
 

Offline caroper

  • Regular Contributor
  • *
  • Posts: 193
  • Country: za
    • Take your PIC
Re: Simple Microcontroller for a beginner
« Reply #26 on: February 22, 2012, 07:38:39 am »
If someone says they would like to learn how to drive, would you get in the car with them and allow them to drive to the shops, whist you give advice?


Or would you point to a workshop and say "OK all the bits are in there, build it and you will know how to drive it".


Most people learn how to drive before they learn how the car works, I see no reason why uC's should be any different.

Offline DrGeoff

  • Frequent Contributor
  • **
  • Posts: 794
  • Country: au
    • AXT Systems
Re: Simple Microcontroller for a beginner
« Reply #27 on: February 22, 2012, 08:01:35 am »
If someone says they would like to learn how to drive, would you get in the car with them and allow them to drive to the shops, whist you give advice?


Or would you point to a workshop and say "OK all the bits are in there, build it and you will know how to drive it".


Most people learn how to drive before they learn how the car works, I see no reason why uC's should be any different.

That's complete piffle and you know it. Most people who drive a car could not care less about how it works. And the same goes for PC's.

The OP wanted to learn about microcontrollers. To do this you need to understand what is inside them, clock and interrupt options, I/O configuration, ALU, hardware multipliers, memory organisation etc.
This is not the same as simply using a board to prove a product concept or to learn about programming them. Learning to program the microcontroller with a tool kit and a dev board does not teach you how micirocontrollers work. In fact you don't even need to look at the circuit, just read the programming instructions and follow the guidelines.
Was it really supposed to do that?
 

Offline harnon

  • Regular Contributor
  • *
  • Posts: 215
  • Country: au
  • Is this thing on?
    • My Personal Website
Re: Simple Microcontroller for a beginner
« Reply #28 on: February 22, 2012, 11:03:50 am »
This could go on forever  :D

What about something like this to help people make the "upgrade"?
 

Offline amyk

  • Super Contributor
  • ***
  • Posts: 8286
Re: Simple Microcontroller for a beginner
« Reply #29 on: February 22, 2012, 12:19:36 pm »
I started with the 8051... but once you know the basics it's not hard to go with any MCU you want. It doesn't have to be a costly endeavour either.

Here's a good example of how you can program one with nothing more than a few wires and a PC.
http://www.instructables.com/id/Ghetto-Programming%3A-Getting-started-with-AVR-micro/

I don't recommend Arduino or whatever other dev board for just starting out - sure you get a nice PCB and attached parts, but for the same price you could buy multiple chips and a bunch of other stuff to play with.
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #30 on: February 22, 2012, 03:41:16 pm »
I guess I'll have to somewhat change my answer.  If your intent is to learn to incorporate micro controllers into a circuit, there is nothing wrong with Arduino.  If your intent is to learn how micro controllers work, then you need to do things from scratch (be it assembly or c).  I think small assembly programs are essential if you want to KNOW what the mcu does.  (You CAN do this using an Arduino compatible board if you want.)

That being said, if Arduino existed when I was in High School, I would have been much further in micro controller understanding before college than I was.  I had no internet and no electronics mentor and completely failed in creating any successful micro controller circuit.  I had very little money and no real lab power supply.  I found a long scroll of thermal paper in my box from Mom's basement a couple months ago that was from the Radio Shack fax back service.  Those were the only data sheets I had access to.

My "micro controller" experience was the 6502 processor in my very old Apple IIe, that I used to learn assembler.  I would have killed for a device that I could plug into my 386 and just work like an Arduino.  So I won't belittle anyone using Arduino to get started.

With the resources available online, making a full micro circuit and even your own programmer is within the grasp of a motivated person.
« Last Edit: February 22, 2012, 03:42:58 pm by sacherjj »
 

Offline cowboy303Topic starter

  • Regular Contributor
  • *
  • Posts: 82
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #31 on: February 22, 2012, 04:19:38 pm »
Quote
or if your looking for budget order a MSP430 launch pad. Tons of example programs, simple enough. and very cheap.


Thanks guys.

I really like the price of the MSP430 launch pad. Has any body tryed it?  And is it any good? 
But for $4.30 I can blow it up or throw it out the widow and I don't have to worry about it you really can't go wrong.

Thank you every body for all you input.
« Last Edit: February 23, 2012, 01:53:54 am by cowboy303 »
 

Offline olsenn

  • Frequent Contributor
  • **
  • Posts: 993
Re: Simple Microcontroller for a beginner
« Reply #32 on: February 22, 2012, 04:30:44 pm »
Atmel makes a very nice set of microcontrollers, including the Atmega328 which the Arduino platform mentioned above is based on. If you'd like to learn the process of making a making a mass producable product or even just would like to have several projects on the go, I'd recommend buying the bare Atmel IC's and an AVR Dragon programmer. However, if you would like to hack something together quickly that involves controlling digital pins, then the actual Arduino is as simple as you're going to get. It is worth noting that the Arduino bootloader may be programmed manually onto the bare IC's as well so that programs you write for the Arduino will still work with your mass producable products; but if that's the route you plan on going you're probably better off just learning C or even AVR assembly and doing it the long but efficient route.

Hope this helps
 

Offline Deepak

  • Regular Contributor
  • *
  • Posts: 76
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #33 on: February 22, 2012, 05:02:57 pm »
Quote
or if your looking for budget order a MSP430 launch pad. Tons of example programs, simple enough. and very cheap.


Thanks guys.

I really like the price of the MSP430 launch pad. Has any body tryed it?  And is it any good? 
But for $4.30 you can't really go wrong.

Thank you every body for all you input.

Yes, and it is. There are chips that have better performance, but if you're just beginning then that shouldn't be an issue.

I'd agree with the other folks who say that you should skip the Arduino if you want to actually learn how microcontrollers work. I'd also recommend learning C and skipping ASM - doubly so if you haven't done any programming before.
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #34 on: February 22, 2012, 05:11:44 pm »
My personal thought is that the MSP430 is an ok platform, but it might be worth the added expense to jump into either the PIC or AVR space, mainly because of the capabilities of the chips.  If you want to use a micro controller for a more complex job, you will most likely need to jump there anyway.  There also seem to be many more resources available on either the PIC or AVR.

That said, you will gain knowledge that will transfer to platforms if you start with the MSP430.  It really is quite a big bang for the buck.

I'd agree with the other folks who say that you should skip the Arduino if you want to actually learn how microcontrollers work. I'd also recommend learning C and skipping ASM - doubly so if you haven't done any programming before.

I think to start this is correct.  However, once you are comfortable with C, it is a good thing to write a small bit of code in assembly.  Even if this is just following an example to flash an LED.  There is some good mental growth in getting down to that level that can aid debugging problems with projects written at a higher level.
« Last Edit: February 22, 2012, 05:15:09 pm by sacherjj »
 

Offline harnon

  • Regular Contributor
  • *
  • Posts: 215
  • Country: au
  • Is this thing on?
    • My Personal Website
Re: Simple Microcontroller for a beginner
« Reply #35 on: February 22, 2012, 05:47:41 pm »
I guess I'll have to somewhat change my answer.  If your intent is to learn to incorporate micro controllers into a circuit, there is nothing wrong with Arduino.  If your intent is to learn how micro controllers work, then you need to do things from scratch (be it assembly or c).  I think small assembly programs are essential if you want to KNOW what the mcu does.  (You CAN do this using an Arduino compatible board if you want.)
Probably not a bad way to look at it!

Here's a good example of how you can program one with nothing more than a few wires and a PC.
http://www.instructables.com/id/Ghetto-Programming%3A-Getting-started-with-AVR-micro/
Errm... not being funny but I haven't seen a PC with a parallel port on it for a good 6-8 years :D  The USB version is probably more relevant for most beginners (although it costs $22 for the programmer so you're back where we started).
 

Offline cowboy303Topic starter

  • Regular Contributor
  • *
  • Posts: 82
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #36 on: February 22, 2012, 06:39:43 pm »
Here's a good example of how you can program one with nothing more than a few wires and a PC.
http://www.instructables.com/id/Ghetto-Programming%3A-Getting-started-with-AVR-micro/
Quote
Errm... not being funny but I haven't seen a PC with a parallel port on it for a good 6-8 years :D  The USB version is probably more relevant for most beginners (although it costs $22 for the programmer so you're back where we started).

This my be irrelevant but Mine does ;D
« Last Edit: February 23, 2012, 12:50:05 am by cowboy303 »
 

Offline Deepak

  • Regular Contributor
  • *
  • Posts: 76
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #37 on: February 22, 2012, 07:12:08 pm »
Quote from: sacherjj
I think to start this is correct.  However, once you are comfortable with C, it is a good thing to write a small bit of code in assembly.  Even if this is just following an example to flash an LED.  There is some good mental growth in getting down to that level that can aid debugging problems with projects written at a higher level.

Agree, and I'd add that sometimes you just need to use (inline ;)) assembly for speed.
« Last Edit: February 22, 2012, 07:14:05 pm by Deepak »
 

Offline CraigP

  • Newbie
  • Posts: 2
Re: Simple Microcontroller for a beginner
« Reply #38 on: February 22, 2012, 09:50:26 pm »
I'm very new to programming MCU as well as electronics in general.  However I've always wanted to learn and do more.  I recently started to learn the PIC base class of MCUs and have had a great time.  I'm using simple chips and am learning via online tutorials.  I can send a link if you are interested in.  One of the things I liked about the PIC was I can get pics for like 75 cents each.  Now granted I'm not going to do complex operations with those chips, but for learning I'm not looking for complex at first.  Also I wanted chips that I could take out of the programmer and add right to my circuit.  And with these prices I can do that.  Even if it is a super simple (silly) little circuit I can afford to just add the chip.  I went with a PICKIT2 to do the programming and I use the free included software.  Mostly I just use assembly for programming and it seems easy enough to learn.

The issue I had with Arduino is that it seemed very complicated to get started.  This is just my impression, not that of anyone else.  I was confused by the progammers and chips and the atmel connection etc...  I just was confused on if I could just pull the chip off the board and stick it in my project.  And if I could, how much did that chip cost?  Again, just me talking, but in the PIC world I can see how I pick and chip based on its features so again, if I need something very simple I can get away with a $0.75 chip.  If I need something fancy maybe it will cost me a couple bucks....  But I could scale up and down as I needed...

Quick edit: the programmer will cost you more going this way.  As The programmer is like 45$.  But again, you can pop chips in and out of the programmer (for programming) and then add them to your circuit.

Anyway... Just a few things to think about. 
« Last Edit: February 22, 2012, 09:53:14 pm by CraigP »
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #39 on: February 22, 2012, 10:48:21 pm »
I'm very new to programming MCU as well as electronics in general.  However I've always wanted to learn and do more.  I recently started to learn the PIC base class of MCUs and have had a great time.  I'm using simple chips and am learning via online tutorials.  I can send a link if you are interested in.  One of the things I liked about the PIC was I can get pics for like 75 cents each.  Now granted I'm not going to do complex operations with those chips, but for learning I'm not looking for complex at first.  Also I wanted chips that I could take out of the programmer and add right to my circuit.  And with these prices I can do that.  Even if it is a super simple (silly) little circuit I can afford to just add the chip.  I went with a PICKIT2 to do the programming and I use the free included software.  Mostly I just use assembly for programming and it seems easy enough to learn.

The issue I had with Arduino is that it seemed very complicated to get started.  This is just my impression, not that of anyone else.  I was confused by the progammers and chips and the atmel connection etc...  I just was confused on if I could just pull the chip off the board and stick it in my project.  And if I could, how much did that chip cost?  Again, just me talking, but in the PIC world I can see how I pick and chip based on its features so again, if I need something very simple I can get away with a $0.75 chip.  If I need something fancy maybe it will cost me a couple bucks....  But I could scale up and down as I needed...

Quick edit: the programmer will cost you more going this way.  As The programmer is like 45$.  But again, you can pop chips in and out of the programmer (for programming) and then add them to your circuit.

Anyway... Just a few things to think about.

Pricewise, PIC and AVR chips are comparable.  For the cheap chips, AVR has the ATTiny.  Rather than pulling a chip out of the programmer each time, you will eventually put in an ISP header that you would connect your PIC or AVR programmer to for reprogramming.  This is faster and with less socketting wear on the chip.

To get started with Arduino style, you install the software and get a dev board (like the Arduino Uno).  It is much simpler than an easy PIC or AVR circuit.  You don't use a programmer, the AVR micro has a bootloader that allows you to send the new program via the included USB connection.

You can setup PICs in this manner as well, with a boot loader.  It does consume some of the possible storage capability of the chip.
 

Offline Spiro

  • Contributor
  • Posts: 34
  • Country: cs
Re: Simple Microcontroller for a beginner
« Reply #40 on: February 22, 2012, 11:31:07 pm »
Atmel MC are good for learning because they are simple to program. You only need comp. with parallel port.
I was amazed  how easy the whole procedure is (ATMEGA16).
 

Offline cowboy303Topic starter

  • Regular Contributor
  • *
  • Posts: 82
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #41 on: February 23, 2012, 01:38:10 am »
I started with the 8051... but once you know the basics it's not hard to go with any MCU you want. It doesn't have to be a costly endeavour either.

Here's a good example of how you can program one with nothing more than a few wires and a PC.
http://www.instructables.com/id/Ghetto-Programming%3A-Getting-started-with-AVR-micro/

I don't recommend Arduino or whatever other dev board for just starting out - sure you get a nice PCB and attached parts, but for the same price you could buy multiple chips and a bunch of other stuff to play with.

Can you program any chip like PIC 16F690 or ATMEGA16 or does it have to be the attiny 2313 chip?
And is it any harder to program software wise?
AND THANKS AGAIN FOR ALL YOUR HELP
« Last Edit: February 23, 2012, 01:46:14 am by cowboy303 »
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 9964
  • Country: nz
Re: Simple Microcontroller for a beginner
« Reply #42 on: February 23, 2012, 06:10:50 am »
And don't be persuaded by people (and I used to be guilty of this) that tell you that you have to learn Assembler to truly program a microcontroller. Learn C, all embedded development is headed that way now, and you can still use assembler later once you are used to the concepts of programming.

Yeah, the price of high speed 32bit ARM micros is dropping so much there really isn't much of a need for assembler anymore.
Not when the price difference is like this
- NZ$4 can buy a 20mhz 8bit  ATMega with 16KB Flash, 1K ram and 512B eeprom
- NZ$6 can buy a 50mhz 32bit ARM micro with 32KB flash  8K RAM and 2K eeprom and onboard usb controller.

The few cases were assembler is still needed are quite rare.
Well.. rare except for tight ass company management that refuse to move a product to a faster micro and instead force the engineers to keep cramming more and more code into a tiny 8bit micro and moving code to lookup tables.  >:(
« Last Edit: February 23, 2012, 06:19:15 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4207
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #43 on: February 23, 2012, 09:25:04 am »
For most of the "old school" microcontrollers (8 and 16bit, like PIC, AVR, MSP430, and etc), you'll need to have some understanding of assembly language and assembly language concepts in order to be able to understand the datasheets and peripherals.  ARMs, not so much.  Datasheets with C code, standard and vendor-provided libraries to do most of the low-level twiddling, and a single address space that simplifies ... a lot.

I'll second the Arduino recommendation.  You can treat it at as low a level as you want, but the main difference is that you can avoid having to learn parts that you're not as interested in.  For instance, you could write a low-level serial servo controller without having to learn about the UART.  Not Much, anyway.  And you can debug using "print" statements!
 

Offline electrode

  • Regular Contributor
  • *
  • Posts: 141
  • Country: au
Re: Simple Microcontroller for a beginner
« Reply #44 on: February 23, 2012, 09:30:29 am »
- NZ$4 can buy a 20mhz 8bit  ATMega with 16KB Flash, 1K ram and 512B eeprom
- NZ$6 can buy a 50mhz 32bit ARM micro with 32KB flash  8K RAM and 2K eeprom and onboard usb controller.

Ooo. Which ARM? They are really good value, but when I had a brief look awhile ago, they had roughly those specs, but lacked EEPROM.
 

Online Psi

  • Super Contributor
  • ***
  • Posts: 9964
  • Country: nz
Re: Simple Microcontroller for a beginner
« Reply #45 on: February 23, 2012, 09:56:44 am »
Ooo. Which ARM? They are really good value, but when I had a brief look awhile ago, they had roughly those specs, but lacked EEPROM.

This is the one i was referring to

http://search.digikey.com/nz/en/products/LPC11U24FHI33%2F301,/568-8523-ND/2772164

LPC11U24FHI33/301

ARM Cortex-M0  (so old but hey, its still a 32bit ARM cpu)
up to 50MHz clock
I²C, Microwire, SPI, SSI, SSP, UART/USART, USB,Brown-out Detect/Reset, POR, WDT
26 I/O
32KB FLASH
2K EEPROM
8K RAM
1.8V-3.6V
8 channel 10bit A/D
Internal oscillator option.

The only annoying thing about it is the package, which is QFN, however there's also the LPC11U23FBD48/301 which is LQFP for $5.98 and the specs aren't that different.
24KB FLASH
1K EEPROM
40 I/O

I'm not sure about the cost of programmers/debuggers though
« Last Edit: February 23, 2012, 10:02:21 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline electrode

  • Regular Contributor
  • *
  • Posts: 141
  • Country: au
Re: Simple Microcontroller for a beginner
« Reply #46 on: February 23, 2012, 10:06:04 am »
Ah thanks, pretty awesome. Definitely the next thing I'd be looking into once I outgrow AVR.
 

Offline sacherjj

  • Frequent Contributor
  • **
  • Posts: 993
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #47 on: February 23, 2012, 05:25:52 pm »
Yeah, the price of high speed 32bit ARM micros is dropping so much there really isn't much of a need for assembler anymore.
Not when the price difference is like this
- NZ$4 can buy a 20mhz 8bit  ATMega with 16KB Flash, 1K ram and 512B eeprom
- NZ$6 can buy a 50mhz 32bit ARM micro with 32KB flash  8K RAM and 2K eeprom and onboard usb controller.

The few cases were assembler is still needed are quite rare.
Well.. rare except for tight ass company management that refuse to move a product to a faster micro and instead force the engineers to keep cramming more and more code into a tiny 8bit micro and moving code to lookup tables.  >:(

It all depends on the intended task.  I'm betting the 50 mhz 32bit ARM doesn't quite run as long on the same battery as the slower 8-bit micros.
 

alm

  • Guest
Re: Simple Microcontroller for a beginner
« Reply #48 on: February 23, 2012, 07:27:38 pm »
The ARM Cortex M0 is actually a variant of the Cortex M3 which is optimized for low costs, low power and small footprint. It was designed to compete with the 8 and 16-bit micros. Not with the much faster M3 and M4. So power draw might actually be not too far off, especially at slower clockspeeds, but I haven't studied them in detail.
 

Offline Sal Ammoniac

  • Super Contributor
  • ***
  • Posts: 1684
  • Country: us
Re: Simple Microcontroller for a beginner
« Reply #49 on: February 23, 2012, 08:34:23 pm »
PIC has been a pain in the arse for me .

The 8-bit PIC is such a brain-dead architecture I'm surprised anyone is still using it. Momentum and stubbornness, I guess.

If you need an 8-bit MCU, AVR is a much better choice. For 16-bit, the MSP430 has a very elegant architecture, and is very low power too. PIC-16 is also nice (it's a totally new architecture and not like its retarded 8-bit brother).

ARM is the way to go with 32-bit as it's supported by just about every MCU company out there with the exception of Microchip. The MIPS-based PIC-32 isn't bad, but it's swimming against the ARM tidal wave. The same with the AVR32. If you do go with ARM, don't go with the older ARM7 architecture -- the newer Cortex-M0 and -M3 series is much easier to use.

Then there are the exotics, which fit well into certain niche applications: the Parallax Propeller and the XMOS. These are both fast, 32-bit multicore MCUs. The XMOS is a blazing fast chip that supports hardware threading, multiple cores, and easy linking of multiple chips together. It's the grandson of the Transputer (both designed by David May) and supports XC (C with parallel extensions), C, and C++ with free Eclipse-based development tools.

The Propeller is very easy for a beginner to use, especially if you're designing the hardware around it. Two drawbacks are that its primary language, Spin, is interpreted and is not C. C is supported, but in a kludgy way.
Complexity is the number-one enemy of high-quality code.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf