EEVblog Electronics Community Forum

Electronics => Beginners => Topic started by: cowboy303 on February 21, 2012, 03:20:00 pm

Title: Simple Microcontroller for a beginner
Post by: cowboy303 on February 21, 2012, 03:20:00 pm
I've made a few circuits and and I would like to try my hand at Microcontrollers but there are so many out there I don't know which one to get.  I don't know much about them I thought if I get my feet wet, it would help me understand what others are talking about.
So which Microcontroller do you suggest I want to make blinky LED and some PWM maybe some stuff with rotary encoders just some of the basics.
And which programmer and software do I use.
I've watched a few of Dave's videos but they don't make much sense, And that's I'm doing this, If somebody has a good video or something they know of If they wouldn't mind sharing it that would be very nice

Thank you all and if you got any questions feel free to ask goodness knows I forgot something.
And thank you all for all your help in the last few weeks.
Title: Re: Simple Microcontroller for a beginner
Post by: caffeinatedbard on February 21, 2012, 03:27:51 pm
For a beginner, I would suggest you get yourself an Arduino board starter kit from either adafruit or sparkfun. 

Then, for a video tutorial series I suggest Jeremy Blum's blog.  If you are more ambitious, the Arduino software has tons of example code.

http://www.jeremyblum.com/category/arduino-tutorials/ (http://www.jeremyblum.com/category/arduino-tutorials/)

If you want to learn about more of the hardware side, visit sparkfun's website.

http://www.sparkfun.com/tutorials/57 (http://www.sparkfun.com/tutorials/57)

This should keep you busy for a couple of months if you go at it diligently.  Once you become very familiar with these building blocks you will begin to understand the lingo and be more knowledgeable in the world of embedded systems.

Good luck!
Title: Re: Simple Microcontroller for a beginner
Post by: TerminalJack505 on February 21, 2012, 03:33:20 pm
Yep, Arduino seems the way to go.  You can pick one up at your local Radio Shack.
Title: Re: Simple Microcontroller for a beginner
Post by: 8086 on February 21, 2012, 08:02:51 pm
I'll probably get jumped on for suggesting it, but I think you should try PICs

Arduino is just too easy. You get things done very fast, and get results you want, but you learn little on the way.
Title: Re: Simple Microcontroller for a beginner
Post by: alm on February 21, 2012, 08:24:25 pm
I don't see the problem. Just start with Arduino to learn the basics of embedded programming and hardware interfacing, and move to programming the AVR in plain C once you outgrow the Arduino. You can even continue using the same hardware. I see no inherent advantage in PIC for learning, but no disadvantage either.
Title: Re: Simple Microcontroller for a beginner
Post by: caroper on February 21, 2012, 08:26:20 pm
6 months ago I too would have suggested PIC but since then I have been introduced to ARDUINO, reluctantly I might add, and am now persuaded as to its benefits for a beginner.


I used to teach Microprocessor Techniques at collage level, way back in the 80's on 6800 and 6809 platforms, so picking up a PIC was just a matter of learning a new assembler and working out the advances in technology since the 80's.


I was up and running reasonably fast, but I had to invest in a development board, PICKit programmer, learn a new IDE, and worst off all, I had to wade through 13inch thick pile of Microchip data sheets.


The Arduino, on the other hand, is a development board that needs no programmer, has a simple IDE, comes with a ton of examples, has lots of easily accessible tutorials and a very helpful community to back it up.


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.


You are doing this for fun, not a theoretical computing course in collage, why make it hard on yourself.



Title: Re: Simple Microcontroller for a beginner
Post by: sacherjj on February 21, 2012, 09:36:28 pm
I'll probably get jumped on for suggesting it, but I think you should try PICs

Arduino is just too easy. You get things done very fast, and get results you want, but you learn little on the way.

There is plenty to learn just in the interfacing with a micro, for those that have not done it. 
Title: Re: Simple Microcontroller for a beginner
Post by: 8086 on February 21, 2012, 09:43:32 pm
I'll probably get jumped on for suggesting it, but I think you should try PICs

Arduino is just too easy. You get things done very fast, and get results you want, but you learn little on the way.

There is plenty to learn just in the interfacing with a micro, for those that have not done it.

Yes, yes. Connect wires here, there, done.

The point is, it's all out there, ready for you to copy/paste and just follow the instructions. You don't even have to think to use an Arduino.

For blinking an LED, and PWM, PIC would be pretty simple too, but you would have to think more to get the result.

Maybe I'm just tired of Arduino being the standard answer for beginners. I never had an Arduino, and I don't see why everyone needs to be spoon-fed. There's nothing wrong with something taking time and effort to complete.
Title: Re: Simple Microcontroller for a beginner
Post by: DrGeoff on February 21, 2012, 09:53:20 pm
Yes, yes. Connect wires here, there, done.

The point is, it's all out there, ready for you to copy/paste and just follow the instructions. You don't even have to think to use an Arduino.

For blinking an LED, and PWM, PIC would be pretty simple too, but you would have to think more to get the result.

Maybe I'm just tired of Arduino being the standard answer for beginners. I never had an Arduino, and I don't see why everyone needs to be spoon-fed. There's nothing wrong with something taking time and effort to complete.

Completely agree.
Buy a chip (PIC16/18 or AVR) and a breadboard and learn to read the datasheet, wire it up and program it. Now you are learning about microcontrollers, not just someone else's pre-built modules. You get to learn about the internal architecture of the device, various mechanisms to make it do things and  can rewire it however you want, from blinking leds, LCD's or reading analogue and digital inputs. This is real learning.
Title: Re: Simple Microcontroller for a beginner
Post by: harnon on February 21, 2012, 10:07:41 pm
Yes, yes. Connect wires here, there, done.

The point is, it's all out there, ready for you to copy/paste and just follow the instructions. You don't even have to think to use an Arduino.

For blinking an LED, and PWM, PIC would be pretty simple too, but you would have to think more to get the result.

Maybe I'm just tired of Arduino being the standard answer for beginners. I never had an Arduino, and I don't see why everyone needs to be spoon-fed. There's nothing wrong with something taking time and effort to complete.

Completely agree.
Buy a chip (PIC16/18 or AVR) and a breadboard and learn to read the datasheet, wire it up and program it. Now you are learning about microcontrollers, not just someone else's pre-built modules. You get to learn about the internal architecture of the device, various mechanisms to make it do things and  can rewire it however you want, from blinking leds, LCD's or reading analogue and digital inputs. This is real learning.

I disagree! :D  For most people starting out on micros, a PIC or Atmel is way too scary!  If you don't know what you are doing there are so many things that can go wrong... and then there are the choices - which chip (as a human race we can't even agree on PIC vs Atmel  ;)), too many programming languages (ASM, C, Basic???), too many programmers (Official, unofficial, JTAG, Pickit2, Pickit3, devboard, etc.), and for the beginner without a scope, proper multimeters, logic analysers etc. debugging can be a nightmare.  Whats wrong with buying an Arduino to learn on, which is the cost of a single PIC programmer?

Further, if you run into trouble the options for help with a PIC are - 20 year old articles on the web about extinct chips written in ASM, a 300 page datasheet, or trial and error (ok maybe a bit of an overstatement but not far off).  Not so much a learning experience as a lesson in being demoralised :D   I'm not saying I think buying a breadboard, xtal, caps, programmer, wiring up ICSP etc is a bad way to do it, its just an order of magnitude more difficult and expensive for somebody who knows next to nothing but wants to learn more.  You don't start a university degree in third year... baby steps, right?
Title: Re: Simple Microcontroller for a beginner
Post by: 8086 on February 21, 2012, 10:26:12 pm
A blinking LED program in assembler is only a few lines of code, and a few settings for programming. The circuit is also quite simple to breadboard.

What you are saying about cost is true. However, once you have bought, for the sake of argument, a PicKit 3, you then can program just about any PIC you choose. You can use as simple or complex a PIC as you wish. Use the same programmer for multiple projects. There's literally thousands of choices.

PIC datasheets are ~300 pages simply because they contain a lot of information about the chip, most of which you don't need for this. There's only about 6 pages you need to pay attention to to get a blinking LED program to work.


Title: Re: Simple Microcontroller for a beginner
Post by: DrGeoff on February 21, 2012, 10:28:48 pm
I disagree! :D  For most people starting out on micros, a PIC or Atmel is way too scary!  If you don't know what you are doing there are so many things that can go wrong... and then there are the choices - which chip (as a human race we can't even agree on PIC vs Atmel  ;)), too many programming languages (ASM, C, Basic???), too many programmers (Official, unofficial, JTAG, Pickit2, Pickit3, devboard, etc.), and for the beginner without a scope, proper multimeters, logic analysers etc. debugging can be a nightmare.  Whats wrong with buying an Arduino to learn on, which is the cost of a single PIC programmer?

Further, if you run into trouble the options for help with a PIC are - 20 year old articles on the web about extinct chips written in ASM, a 300 page datasheet, or trial and error (ok maybe a bit of an overstatement but not far off).  Not so much a learning experience as a lesson in being demoralised :D   I'm not saying I think buying a breadboard, xtal, caps, programmer, wiring up ICSP etc is a bad way to do it, its just an order of magnitude more difficult and expensive for somebody who knows next to nothing but wants to learn more.  You don't start a university degree in third year... baby steps, right?

Back in the 1970's in my teens I was designing and constructiing (using wirewrap) 2650 based processor projects. Then hand assembling software to key it in using switches. Then came Z80's, S100 bus etc and we were still designing them from data sheets and writing code to get them to go. There was nothing scary about it, it was simply what you had to do. Now with microcontrollers, PC's and IDE's it is thousands of times easier. There is nothing hard or scary about buying a chip, plugging it into a breadboard and reading the data sheet to work out how to make it do what you want to do. If people find that daunting then maybe they should find something else to do, like accountacy. Learning about the details of the device and what the pins do and making decisions about how and what to connect is all part of the process. Having someone else do it for you is not learning.
Title: Re: Simple Microcontroller for a beginner
Post by: Tony R on February 21, 2012, 10:32:26 pm
"For a beginner, I would suggest you get yourself an Arduino board starter kit from either adafruit or sparkfun."

Although Arduino is a popular choice for tinkerers, I feel it can lead to bad habits. I would say a PIC, AVR, or if your looking for budget order a MSP430 launch pad. Tons of example programs, simple enough. and very cheap.

Struggling is learning, if you don't struggle, you don't learn much.
Title: Re: Simple Microcontroller for a beginner
Post by: caroper on February 21, 2012, 10:34:45 pm
Just because the Arduino has libraries and examples doesn't mean you have no access to the internal structure.
What it does mean is that you can prove your concept quickly or use standard libraries like Serial to get debug output whilst you try your hand at developing a timer/counter based implementation of a frequency counter with duty cycle measurement. You can delve into the datasheets and concentrate on the hardware of interest NOT the Fuses, uarts, interupts etc. that take 3 times as long to set up than the bit of hardware you are trying to focus on learning.
Title: Re: Simple Microcontroller for a beginner
Post by: TerminalJack505 on February 21, 2012, 10:40:29 pm
If you go the chip/breadboard/programmer route then I suggest you get an FTDI cable as well. 

An FTDI cable will allow you to send information (debug messages, for example) via the MCU's UART (at TTL levels) to a terminal program on your PC.

If you can find one, get the TTL-232RG-VIP-WE.  This one will work with any TTL voltage level from 1.8V to 5.25V.  The other ones will only work with a specific voltage level--3.3V, for example.  You will have to put a connector on the cable yourself, however.

So far as chip and programmer go, I'd suggest an Atmel AVR ATmega 168 and the AVRISP mkII.  Use Atmel's free AVR Studio for development.

All of this will cost you about $60.
Title: Re: Simple Microcontroller for a beginner
Post by: harnon on February 21, 2012, 10:49:42 pm
A blinking LED program in assembler is only a few lines of code, and a few settings for programming. The circuit is also quite simple to breadboard.
If its that simple, how does it provide a better or worse experience than an Arduino? Aren't the concepts similar or the same? 


Back in the 1970's in my teens I was designing and constructiing (using wirewrap) 2650 based processor projects
Dr Geoff, I don't doubt that things are easier now than they were 30 years ago! Although perhaps thats part of the problem, as what may seem trivial to some of you (as you've been doing it for yonks) is much more daunting to newcomers.

or if your looking for budget order a MSP430 launch pad. Tons of example programs, simple enough. and very cheap.
Wow, they are very cheap...

Struggling is learning, if you don't struggle, you don't learn much.
I don't quite follow the correlation between quantity of struggling and quantity of learning :D


I'm not really arguing in favour of Arduino over any other particular method, just defending those who seem to be automatically against it as a "weak" alternative.  Looking at this yet another way, until a few years ago I was coached state championship junior basketball in Oz.  I would still go back and run basic, fun clinics for kids at my old club to get them involved in the sport. I found experimentally that for most kids having a fun introduction was far more likely to make them come back for more.  Anyway, I hope we aren't hijacking the thread too much!
Title: Re: Simple Microcontroller for a beginner
Post by: johnboxall on February 21, 2012, 10:54:18 pm
Get an Arduino or compatible board. Have fun, find success and enjoy yourself. However consider this a stepping-stone onto more involved methods and architectures.
Title: Re: Simple Microcontroller for a beginner
Post by: cowboy303 on February 21, 2012, 10:55:12 pm
Struggling is learning, if you don't struggle, you don't learn much.
I absolutely agree I want something easy to program.  But I'm not going to copy paste if you know what I mean.
The cheaper the better for me for this is only my hobby so I don't want a go to crazy <$20 but if it stands out and is much better I would be willing to go a bit higher.
I would like something I can program a chip with, and disconnect it then put it in my circuit.
That way if have another project I can just get another chip for <$10

Thank you for all your answers ;D
Title: Re: Simple Microcontroller for a beginner
Post by: cowboy303 on February 21, 2012, 11:03:44 pm
Get an Arduino or compatible board. Have fun, find success and enjoy yourself. However consider this a stepping-stone onto more involved methods and architectures.
Which Arduino/PIC/AVR programmer do you suggest there seam to be a lot of different models ;D Thanks.
Title: Re: Simple Microcontroller for a beginner
Post by: caroper on February 21, 2012, 11:14:34 pm
You could jump in the deep end and silence both camps with a ChipKit Uno 32 - PIC32 based Arduino clone :)

The Arduino can be used as a programmer to program AVR chips.

If you do want to go for a basic PIC set up on a bread board, my favorite is a 16F690 for beginners.
It has a full set of peripherals and a pretty good internal RC oscillator.
Easy to set up and Not to hard to learn.

BUT even as a PIC fan I suggest you go arduino to start and I say that based on many years of teaching, it is a damn good tool when you get beneath the hype.
You learn more in Arduino Playground than Arduino.cc

Title: Re: Simple Microcontroller for a beginner
Post by: johnboxall on February 22, 2012, 02:26:14 am
Get an Arduino or compatible board. Have fun, find success and enjoy yourself. However consider this a stepping-stone onto more involved methods and architectures.
Which Arduino/PIC/AVR programmer do you suggest there seam to be a lot of different models ;D Thanks.

In the Arduino world, these guys have the best boards:
http://www.freetronics.com/collections/arduino (http://www.freetronics.com/collections/arduino)

The Digilent Chip kit Uno32 is a good 32-bit PIC board, but not so good for a direct Arduino replacement.
Title: Re: Simple Microcontroller for a beginner
Post by: sacherjj on February 22, 2012, 02:35:51 am
Which Arduino/PIC/AVR programmer do you suggest there seam to be a lot of different models ;D Thanks.

I don't think you would go wrong with either a PicKIT 2 or 3.  I would not currently recommend an AVR ISP II.  Through the brilliance of AVR, this no longer works with the latest version 5 of their development system.  If you get one (it is what I use) just know that you must stay with version 4.  With all the bugs in 5, you are better off anyway.

If you start with an Arduino, you will need to programmer, save your USB port.  You can also use the Arduino board to work as an ISP.

As someone who had to build an 8-bit RISC processor from gate level components in college, I don't mind taking a shortcut to systems that are easily modifiable or have previous software written.  Arduino can be restricting, but can also let you just get crap done.  :)
Title: Re: Simple Microcontroller for a beginner
Post by: 8086 on February 22, 2012, 04:05:15 am
A blinking LED program in assembler is only a few lines of code, and a few settings for programming. The circuit is also quite simple to breadboard.
If its that simple, how does it provide a better or worse experience than an Arduino? Aren't the concepts similar or the same? 

Writing for Arduino is like simply writing software. You know it makes real physical things happen, but you don't know how. All you know is that you asked it to set a pin high and it did it for you.

This isn't bad in itself, and you can always read the device datasheet if you want to understand more, but it's the fact that you don't have to do anything extra in order to get things done that I consider a barrier to learning.

When you write for PICs, you must refer to the specific device's datasheet etc. There's much more exposure to more information, which I consider a good thing.

Without getting into specific code examples, I will just say that I consider Arduino to just be a toy, for when things need to get done, but most definitely not a tool for learning about microcontrollers. More of a tool for just learning about...Arduino.
Title: Re: Simple Microcontroller for a beginner
Post by: MarkS on February 22, 2012, 04:25:17 am
My first micro was a Parallax Propeller. Sure, it has its issues, but it is shockingly simple to use and it is powerful. Being able to wire up a circuit including a micro and program it to do something without having any prior MCU knowledge really helped my confidence.

I just cannot bring myself to the level required to jump on board the Arduino bus. It has the feel of a cult. Like you have to drink the Kool-Aid to get started. :o
Title: Re: Simple Microcontroller for a beginner
Post by: sacherjj on February 22, 2012, 04:35:29 am
A blinking LED program in assembler is only a few lines of code, and a few settings for programming. The circuit is also quite simple to breadboard.
If its that simple, how does it provide a better or worse experience than an Arduino? Aren't the concepts similar or the same? 

Writing for Arduino is like simply writing software. You know it makes real physical things happen, but you don't know how. All you know is that you asked it to set a pin high and it did it for you.

This isn't bad in itself, and you can always read the device datasheet if you want to understand more, but it's the fact that you don't have to do anything extra in order to get things done that I consider a barrier to learning.

When you write for PICs, you must refer to the specific device's datasheet etc. There's much more exposure to more information, which I consider a good thing.

Without getting into specific code examples, I will just say that I consider Arduino to just be a toy, for when things need to get done, but most definitely not a tool for learning about microcontrollers. More of a tool for just learning about...Arduino.

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.

Title: Re: Simple Microcontroller for a beginner
Post by: 8086 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.
Title: Re: Simple Microcontroller for a beginner
Post by: caroper 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.
Title: Re: Simple Microcontroller for a beginner
Post by: DrGeoff 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.
Title: Re: Simple Microcontroller for a beginner
Post by: harnon on February 22, 2012, 11:03:50 am
This could go on forever  :D

What about something like this (http://williamhart.info/tutorials/electronics-tutorials/moving-from-arduino-to-a-microcontroller/) to help people make the "upgrade"?
Title: Re: Simple Microcontroller for a beginner
Post by: amyk 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/ (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.
Title: Re: Simple Microcontroller for a beginner
Post by: sacherjj 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.
Title: Re: Simple Microcontroller for a beginner
Post by: cowboy303 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.
Title: Re: Simple Microcontroller for a beginner
Post by: olsenn 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
Title: Re: Simple Microcontroller for a beginner
Post by: Deepak 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.
Title: Re: Simple Microcontroller for a beginner
Post by: sacherjj 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.
Title: Re: Simple Microcontroller for a beginner
Post by: harnon 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/ (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 (http://www.instructables.com/id/Ghetto-Development-Environment/) is probably more relevant for most beginners (although it costs $22 for the programmer so you're back where we started).
Title: Re: Simple Microcontroller for a beginner
Post by: cowboy303 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/ (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 (http://www.instructables.com/id/Ghetto-Development-Environment/) 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
Title: Re: Simple Microcontroller for a beginner
Post by: Deepak 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.
Title: Re: Simple Microcontroller for a beginner
Post by: CraigP 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. 
Title: Re: Simple Microcontroller for a beginner
Post by: sacherjj 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.
Title: Re: Simple Microcontroller for a beginner
Post by: Spiro 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).
Title: Re: Simple Microcontroller for a beginner
Post by: cowboy303 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/ (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
Title: Re: Simple Microcontroller for a beginner
Post by: Psi 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.  >:(
Title: Re: Simple Microcontroller for a beginner
Post by: westfw 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!
Title: Re: Simple Microcontroller for a beginner
Post by: electrode 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.
Title: Re: Simple Microcontroller for a beginner
Post by: Psi 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 (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
Title: Re: Simple Microcontroller for a beginner
Post by: electrode 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.
Title: Re: Simple Microcontroller for a beginner
Post by: sacherjj 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.
Title: Re: Simple Microcontroller for a beginner
Post by: alm 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.
Title: Re: Simple Microcontroller for a beginner
Post by: Sal Ammoniac 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.
Title: Re: Simple Microcontroller for a beginner
Post by: alm on February 23, 2012, 08:54:22 pm
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).
To keep things simple, the PIC16 does not use a 16-bit architecture, that's the PIC24 and dsPIC series. The PIC32 series is 32-bit. The architecture is less important if you program in C, but the low end (PIC10, 12, 16) PICs aren't very well suited to C either.
Title: Re: Simple Microcontroller for a beginner
Post by: Sal Ammoniac on February 23, 2012, 09:05:10 pm
To keep things simple, the PIC16 does not use a 16-bit architecture, that's the PIC24 and dsPIC series.

Yep, I meant 16-bit PIC. Even their naming convention is brain-dead.  ;)
Title: Re: Simple Microcontroller for a beginner
Post by: harnon on February 24, 2012, 08:46:00 am
Given the op was asking about a chip for a beginner, is there a similar level of online support for ARM M3 as pic/'duino/avr? (eg https://www.eevblog.com/forum/microcontrollers/beginning-cortex-m3-but-so-lost!!/ (https://www.eevblog.com/forum/microcontrollers/beginning-cortex-m3-but-so-lost!!/) seems like a good starting point)  The chips certainly sound promising for some projects i have in mind.
Title: Re: Simple Microcontroller for a beginner
Post by: LukeW on February 24, 2012, 10:07:39 am
Don't get a PIC.

Get an Arduino, at least to start. Then you can build on your Arduino experience to more complex AVR systems, either with different hardware, different software, or both.

Start with simple Arduino projects, and move to more and more complex Arduino projects as you learn more and as you want to learn more.

You can do very complex hardware and software systems based around an Arduino.

As you want to interface more and more complex electronic devices and I/Os and sensors and power supplies and communications to the Arduino, you'll want to and need to learn more about general electronics. And more about programming C.

If you want a serious embedded programming challenge, you can always write "real" C for the AVR, compile it with avr-gcc, and run it on an Arduino board.

If you want to design and build a bespoke PCB, you can always design and build a bespoke PCB that includes an ATmega328 etc. AVR, a crystal, power supplies, a serial interface, and all your appropriate I/O hardware for your project, and you can still use the Arduino bootloader, the Arduino C language and the Arduino IDE to develop code on the AVR - or you can use something like avr-gcc if you wish.
Title: Re: Simple Microcontroller for a beginner
Post by: markus_b on February 24, 2012, 09:13:51 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/ (http://www.instructables.com/id/Ghetto-Programming%3A-Getting-started-with-AVR-micro/)

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?
That circuit can program all AVRs, programmable by ISP and running at 5V (the same voltage as the parallelport). These are the large majority of AVRs. It will not work for the large xMegas and the 5-pin Tinys. It is using the open source avrdude programming software, which can program all AVR chips. It supports about everything, from a direct parallel/serial port connection to the expensive Atmel gear.

I've started out the same, by using a simple (1 transistor) serial port programmer. This works well also in-circuit in homegrown gear. Makes development easy as you just leave everything connected and push new versions to the device to test.
Title: Re: Simple Microcontroller for a beginner
Post by: amyk on February 25, 2012, 09:11:45 am
Some of the newer parallel ports are only 3.3V so they won't work with 5V-only chips.

The ones that require 12V are a little more complex, but you can get that from a PC power supply too. I recommend putting a current limiting resistor on the 12V because it needs <1mA and a 12V to ground short can be a bit exciting.
Title: Re: Simple Microcontroller for a beginner
Post by: Psi on February 25, 2012, 10:40:57 am
Some of the newer parallel ports are only 3.3V so they won't work with 5V-only chips.

The ones that require 12V are a little more complex, but you can get that from a PC power supply too. I recommend putting a current limiting resistor on the 12V because it needs <1mA and a 12V to ground short can be a bit exciting.
You can get massive sparks even at 12V . I had that .

heh yeah, when i play around with my ultracaps i sometimes short out 15V @ 600A for fun. That produces sparks up to ~70cm
Title: Re: Simple Microcontroller for a beginner
Post by: markus_b on February 25, 2012, 11:01:05 am
Some of the newer parallel ports are only 3.3V so they won't work with 5V-only chips.

The ones that require 12V are a little more complex, but you can get that from a PC power supply too. I recommend putting a current limiting resistor on the 12V because it needs <1mA and a 12V to ground short can be a bit exciting.
There are no 5V-only chips, I think. But I always felt that connecting to a parallel port is more risky than connecting to a serial port as you connect directly to a multifuntional chip on the motherboard. If you blow it you blow the motherboard. If you use the serial port you connect to the serial level converter (max232, etc), so if you blow it you may well just have blown the serial port, not the complete PC. This is even more the case if you use a USB-serial cable.

The 12V high-voltage programming is not something I would attempt lightly with a home-grown device. If you need that, then get a AVR-dragon for $50.
Title: Re: Simple Microcontroller for a beginner
Post by: Andy on February 25, 2012, 12:39:32 pm
Some of the newer parallel ports are only 3.3V so they won't work with 5V-only chips.

The ones that require 12V are a little more complex, but you can get that from a PC power supply too. I recommend putting a current limiting resistor on the 12V because it needs <1mA and a 12V to ground short can be a bit exciting.
There are no 5V-only chips, I think. But I always felt that connecting to a parallel port is more risky than connecting to a serial port as you connect directly to a multifuntional chip on the motherboard. If you blow it you blow the motherboard. If you use the serial port you connect to the serial level converter (max232, etc), so if you blow it you may well just have blown the serial port, not the complete PC. This is even more the case if you use a USB-serial cable.

The 12V high-voltage programming is not something I would attempt lightly with a home-grown device. If you need that, then get a AVR-dragon for $50.

How about using a USB-parallel cable then :)
Title: Re: Simple Microcontroller for a beginner
Post by: wkb on February 25, 2012, 01:48:43 pm
Don't get a PIC.


Why not?
Title: Re: Simple Microcontroller for a beginner
Post by: markus_b on February 25, 2012, 02:19:25 pm
How about using a USB-parallel cable then :)
In theory an USB parallel cable would be fine to protect the PC. But, as far as I know, the parallel programming software requires direct access to the parallel port chip, so it would not work with a parallel cable. This would apply to serial cables too, but there are generic (but slow) ways to toggle pins and avrdude knows about those. In addition avrdude has special support for FTDI-chips (USB/serial) and can use high speed with those.

However, from this thread: https://www.eevblog.com/forum/beginners/which-rotary-encoder-for-pwm-project/msg93075/ (https://www.eevblog.com/forum/beginners/which-rotary-encoder-for-pwm-project/msg93075/) I gather that the OP has made his choice (MSP430).
Title: Re: Simple Microcontroller for a beginner
Post by: Tony R on February 25, 2012, 05:17:46 pm
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.

I agree with you, to a point. Programming in assembly really gets you to think about every C instruction you write. When you program in C you don't really understand what all the registers actually do. If you want to set up a PWM, you need to set at least two registers and most likely a couple more to enable it, set the pull up/pull down resistors. But doing it in assembly really gives you a good idea of what is going on behind the scene.

Now, If you are doing it as a hobby do you really need to know assembly? of course not... Do you really need to make the most of your high level code? No.
Title: Re: Simple Microcontroller for a beginner
Post by: Sal Ammoniac on February 25, 2012, 06:00:02 pm
Don't get a PIC.


Why not?

Because there are much better, more modern architectures around. Since this thread is titled "simple microcontroller for a beginner", the original poster is not likely to have an investment in Pic development tools and hardware, so no reason to be locked into the ancient 8-bit Pic. Better to start out with something more modern and easy to understand at the architectural level. (The 16-bit and 32-bit Pics are more modern designs and I wouldn't hesitate to recommend them to someone with a little experience.)

Given the vast amount of software and hardware coming out of the Arduino juggernaut, the AVR is probably a better choice for a beginner, even if he doesn't want to use Arduino hardware.
Title: Re: Simple Microcontroller for a beginner
Post by: Bored@Work on February 25, 2012, 06:45:39 pm
When you program in C you don't really understand what all the registers actually do. If you want to set up a PWM, you need to set at least two registers and most likely a couple more to enable it, set the pull up/pull down resistors. But doing it in assembly really gives you a good idea of what is going on behind the scene.

If you program it in raw C, you see exactly what you do with the registers. Only I you use one of those typically very stupid "driver libraries", or heaven forbit an Arduino, you obscure things.

Randomly picked from an AVR example (including syntax and other errors Atmel likes to show in their examples):

Assembler:
Code: [Select]
WriteTCNT1:
    in r18,SREG        ; Save global interrupt flag
    cli                ; Disable interrupts
    out TCNT1H,r17     ; Set TCNT1 to r17:r16
    out TCNT1L,r16
    out SREG,r18       ; Restore global interrupt flag
    ret

C:
Code: [Select]
void WriteTCNT1(unsigned int val)
{
    unsigned char sreg = SREG;    // Save global interrupt flag
    cli();                        // Disable interrupts
    TCNT1 = val;                  // Set TCNT1 to val
    SREG = sreg;                  // Restore global interrupt flag
}

Hardly any difference.
Title: Re: Simple Microcontroller for a beginner
Post by: wkb on February 25, 2012, 10:43:42 pm
Don't get a PIC.


Why not?

Because there are much better, more modern architectures around. Since this thread is titled "simple microcontroller for a beginner", the original poster is not likely to have an investment in Pic development tools and hardware, so no reason to be locked into the ancient 8-bit Pic. Better to start out with something more modern and easy to understand at the architectural level. (The 16-bit and 32-bit Pics are more modern designs and I wouldn't hesitate to recommend them to someone with a little experience.)

Given the vast amount of software and hardware coming out of the Arduino juggernaut, the AVR is probably a better choice for a beginner, even if he doesn't want to use Arduino hardware.

Ok, could be.  I'd go ARM for that reason though.  Heck, you might be hired by Apple to do their iSomethingOrOther if you get really proficient programming ARM CPUs  ::)
Title: Re: Simple Microcontroller for a beginner
Post by: cowboy303 on February 26, 2012, 12:26:40 am
Quote
However, from this thread: https://www.eevblog.com/forum/beginners/which-rotary-encoder-for-pwm-project/msg93075/ (https://www.eevblog.com/forum/beginners/which-rotary-encoder-for-pwm-project/msg93075/) I gather that the OP has made his choice (MSP430).

Since most of this stuff (like code C ???) is Over my head.  I thought I'd get something for $4.30 that I can plow up or throw out the window and not care.  And that way I know what I'm buying for $30 And if I even want one.  I was putting in a digikey order anyway thought what the heck.
Title: Re: Simple Microcontroller for a beginner
Post by: IanB on February 26, 2012, 12:44:15 am
Since most of this stuff (like code C ???) is Over my head.  I thought I'd get something for $4.30 that I can plow up or throw out the window and not care.  And that way I know what I'm buying for $30 And if I even want one.  I was putting in a digikey order anyway thought what the heck.

If coding in C is over your head then you should definitely be thinking in terms of Arduino as a starting point. Programming computers is not hard to get the hang of, but working with microcontrollers is definitely programming computers. If you have never programmed before, the Arduino would be an excellent place to begin. Let me put it this way--I am a very capable computer programmer who thinks programming C is like a walk in the park--but looking at some microcontroller C code for the first time made my brain hurt. If I spent a couple of hours figuring out how the code maps to the hardware I would be OK, but if you are a beginner I can't honestly recommend you go this way. If you want a gentle introduction to the world of microcontrollers and you are new to programming, then the Arduino is the place to begin. Really. Don't let people tell you anything different.
Title: Re: Simple Microcontroller for a beginner
Post by: markus_b on February 26, 2012, 09:36:20 am
Since most of this stuff (like code C ???) is Over my head.  I thought I'd get something for $4.30 that I can plow up or throw out the window and not care.  And that way I know what I'm buying for $30 And if I even want one.  I was putting in a digikey order anyway thought what the heck.
If coding in C is over your head then you should definitely be thinking in terms of Arduino as a starting point.
I agree with this point of view. As said before, easy programming is the strong point of arduino. You could just have added another $3.5 for a mega168PU and the used the Arduino software to program it. Very much the same as Dave in the power-supply project. Here a link to a tutorial on the subject: Arduino standalone on breadboard (http://arduino.cc/playground/Learning/AtmegaStandalone)
Title: Re: Simple Microcontroller for a beginner
Post by: cowboy303 on February 26, 2012, 03:32:13 pm
Since most of this stuff (like code C ???) is Over my head.  I thought I'd get something for $4.30 that I can plow up or throw out the window and not care.  And that way I know what I'm buying for $30 And if I even want one.  I was putting in a digikey order anyway thought what the heck.
If coding in C is over your head then you should definitely be thinking in terms of Arduino as a starting point.
I agree with this point of view. As said before, easy programming is the strong point of arduino. You could just have added another $3.5 for a mega168PU and the used the Arduino software to program it. Very much the same as Dave in the power-supply project. Here a link to a tutorial on the subject: Arduino standalone on breadboard (http://arduino.cc/playground/Learning/AtmegaStandalone)

I was looking at your link (Please tell me if I'm wrong) looks like you need to have this little guy http://www.sparkfun.com/products/718 (http://www.sparkfun.com/products/718)

I have no idea about what I'm doing but if you go on Ebay and look up atmega8 you get this guy http://www.ebay.com/itm/USBASP-ISP-Programmer-adapter-10-Pin-Cable-f-ATMega8-AVRDude-Tiny-CAN-PWM-Series-/260867187214?_trksid=p5197.m7&_trkparms=algo%3DLVI%26itu%3DUCI%26otn%3D5%26po%3DLVI%26ps%3D63%26clkid%3D6603437073072637844  (http://www.ebay.com/itm/USBASP-ISP-Programmer-adapter-10-Pin-Cable-f-ATMega8-AVRDude-Tiny-CAN-PWM-Series-/260867187214?_trksid=p5197.m7&_trkparms=algo%3DLVI%26itu%3DUCI%26otn%3D5%26po%3DLVI%26ps%3D63%26clkid%3D6603437073072637844)
Is it any good?  I really don't want to plug anything straight in to my laptop.
I've seen a web page that tells you how to connect it up but can't find it know I somebody can help that would be great.
Title: Re: Simple Microcontroller for a beginner
Post by: TerminalJack505 on February 26, 2012, 04:34:42 pm
Quote
I was looking at your link (Please tell me if I'm wrong) looks like you need to have this little guy http://www.sparkfun.com/products/718 (http://www.sparkfun.com/products/718)

I have no idea about what I'm doing but if you go on Ebay and look up atmega8 you get this guy http://www.ebay.com/itm/USBASP-ISP-Programmer-adapter-10-Pin-Cable-f-ATMega8-AVRDude-Tiny-CAN-PWM-Series-/260867187214?_trksid=p5197.m7&_trkparms=algo%3DLVI%26itu%3DUCI%26otn%3D5%26po%3DLVI%26ps%3D63%26clkid%3D6603437073072637844 (http://www.ebay.com/itm/USBASP-ISP-Programmer-adapter-10-Pin-Cable-f-ATMega8-AVRDude-Tiny-CAN-PWM-Series-/260867187214?_trksid=p5197.m7&_trkparms=algo%3DLVI%26itu%3DUCI%26otn%3D5%26po%3DLVI%26ps%3D63%26clkid%3D6603437073072637844)
Is it any good?  I really don't want to plug anything straight in to my laptop.
I've seen a web page that tells you how to connect it up but can't find it know I somebody can help that would be great.

That $5 programmer doesn't look too bad.  Apparently it's based on a proven open hardware design.  It will only work with 5V systems, however.  That is, your circuit (the MCU, specifically) has to be powered at 5V.

It looks like they left an option to use a couple of the pins for serial communication via USB as well.  This must by why they used the 10-pin ISP connector instead of the more compact 6-pin.  According to the site, this isn't implemented yet.  When, and if, it ever is then you would likely need to upgrade the firmware on the programmer.

For 5 bucks you probably can't go wrong.

Edited to add:

I just took a closer look at the pictures.  Apparently there's a resistor that can be removed to support 3.3V systems.  Also, that particular programmer likely won't ever support the serial communication feature since it looks like those pins are permanently connected to GND.  (Or the silkscreen is just mislabeled.)
Title: Re: Simple Microcontroller for a beginner
Post by: markus_b on February 26, 2012, 05:05:43 pm
Is it any good?  I really don't want to plug anything straight in to my laptop.
I've seen a web page that tells you how to connect it up but can't find it know I somebody can help that would be great.
The USBASP is certainly *much* better than a direct connection to a parallel or serial port. If you want competent information I'd scan the avrfreaks.net forum: Google 'usbasp site:avrfreaks.net' and you'll have plenty of reported experiences.

If you want to be able to use the Arduino tools to program you'll need a serial or USB/serial interface (your sparkfun link). There are indications that USBASP support was added recently to the Arduino, but I don't know.
Title: Re: Simple Microcontroller for a beginner
Post by: electrode on February 27, 2012, 12:00:01 am
If you want to be able to use the Arduino tools to program you'll need a serial or USB/serial interface (your sparkfun link).

You can program via ISP too. Just hold shift when clicking compile and upload (version 1.0 onwards).

USBASP isn't in my programmer list in the Arduino tools menu, so you may need to add it yourself (unless it has been added in the newest version). It's probably as simple as a line or two in the preferences file, eg:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1282243271 (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1282243271)
(note that this thread is for adding it as a burning bootloader programmer, not a sketch uploading programmer, but it should be similar)
Title: Re: Simple Microcontroller for a beginner
Post by: cowboy303 on February 27, 2012, 01:00:29 am
Quote
However, from this thread: https://www.eevblog.com/forum/beginners/which-rotary-encoder-for-pwm-project/msg93075/ (https://www.eevblog.com/forum/beginners/which-rotary-encoder-for-pwm-project/msg93075/) I gather that the OP has made his choice (MSP430).

Since most of this stuff (like code C ???) is Over my head.  I thought I'd get something for $4.30 that I can plow up or throw out the window and not care.  And that way I know what I'm buying for $30 And if I even want one.  I was putting in a digikey order anyway thought what the heck.

Before when I said code C is over my head ???.  I meant I have only heard of it and don't know anything about it. And I think it would help everybody if I told you about my self so here it go's.
I'm 15 years old and and started with electronics 4 months ago my first circuit was a full wave rectifier with 4 1n4002 diodes I got from an old TV with 4 nails on a 1 X 4  non of my family member fave any electrical knowledge and mine is very limeted.  I have  designed simple stuff like a charge controller etc so now I'm working on a power supply (very similar to Dave's) and since I learn best by doing I thought I'd try my hand at Microcontrollers to control the thing and that was what the Thread was about I probably should have said this at the beginning but better now then never. 
Title: Re: Simple Microcontroller for a beginner
Post by: IanB on February 27, 2012, 01:25:03 am
The thing is when you are 15 there is a whole world of knowledge ahead of you to learn about. You don't need to feel any pressure to do advanced things right away. There will plenty of time to come to learn everything you could ever want to learn.

When I was 15 we had things like the Commodore PET to learn basic computer functions and programming with. They have gone away now, and the Arduino is probably the spiritual successor to those early home computers.

I would still suggest you start out with the Arduino and move on to more advanced topics with low level programming of microcontrollers later on. It depends a little on how much programming you have already done on desktop computers. If you are new to the whole programming thing then raw programming of micros is going to be a steep learning curve.
Title: Re: Simple Microcontroller for a beginner
Post by: Psi on February 27, 2012, 01:37:05 am
Before when I said code C is over my head ???.  I meant I have only heard of it and don't know anything about it. And I think it would help everybody if I told you about my self so here it go's.
I'm 15 years old and and started with electronics 4 months ago my first circuit was a full wave rectifier with 4 1n4002 diodes I got from an old TV with 4 nails on a 1 X 4  non of my family member fave any electrical knowledge and mine is very limeted.  I have  designed simple stuff like a charge controller etc so now I'm working on a power supply (very similar to Dave's) and since I learn best by doing I thought I'd try my hand at Microcontrollers to control the thing and that was what the Thread was about I probably should have said this at the beginning but better now then never.

The cool thing about Arduino C and micro controllers is you don't have to have any knowlodge to get an LED to flash (or lots of other basic stuff).

There is a huge number of Arduino examples you can just download, build and try without needing to understand the code.
Which is awesome because when getting into microcontrollers for the first time that's half the battle :)
Once you have something that works, even if its just flashing an led, it's easy to play around changing code and seeing what it does.
If you stuff something up you can just copy the original code back in.

And i bet there are tutorials on youtube where people not only show their Arduino code but also explain how it works, which you will find very useful.
Title: Re: Simple Microcontroller for a beginner
Post by: cowboy303 on February 27, 2012, 04:21:12 am
I think arduino is the way to go.  I looked up arduino on eBay and I got nano, mega, dev and  uno...  Which one do I get I'd like some thing that's easy to get started with but will keep me going for awhile. and I like my back pocket to look about the same before and after I perchase it ;).
Thank's everybody once again.
Title: Re: Simple Microcontroller for a beginner
Post by: TerminalJack505 on February 27, 2012, 05:54:05 am
I think arduino is the way to go.  I looked up arduino on eBay and I got nano, mega, dev and  uno...  Which one do I get I'd like some thing that's easy to get started with but will keep me going for awhile. and I like my back pocket to look about the same before and after I perchase it ;).
Thank's everybody once again.

I'd go with an Arduino Uno Rev 3.
Title: Re: Simple Microcontroller for a beginner
Post by: markus_b on February 28, 2012, 08:10:09 am
Before when I said code C is over my head ???.  I meant I have only heard of it and don't know anything about it. And I think it would help everybody if I told you about my self so here it go's.
I'm 15 years old and and started with electronics 4 months ago my first circuit was a full wave rectifier with 4 1n4002 diodes I got from an old TV with 4 nails on a 1 X 4  non of my family member fave any electrical knowledge and mine is very limeted.  I have  designed simple stuff like a charge controller etc so now I'm working on a power supply (very similar to Dave's) and since I learn best by doing I thought I'd try my hand at Microcontrollers to control the thing and that was what the Thread was about I probably should have said this at the beginning but better now then never.
Just to say: I'm now 50, my son is five. If he starts a thread like this in 10 years then I'll be mighty proud !
Title: Re: Simple Microcontroller for a beginner
Post by: markus_b on February 28, 2012, 09:51:08 am
http://www.dealextreme.com/p/jy-mcu-arduino-mega-interactive-media-mega1280-development-board-104318 (http://www.dealextreme.com/p/jy-mcu-arduino-mega-interactive-media-mega1280-development-board-104318)

Dave Seether Approved .
I'm a satisfied customer at dealextreme. Support is a bit slow, but it works. Prices are good, but it takes a couple of weeks for the stuff to arrive (1 week at DX, 2 weeke shipment, 1 week customs).