Microcontrollers?

 

All my projects, robotic or otherwise, have been created using the Arduino. I use it because it's simple, simple, easy and fast, and well simple. but I want to stop splashing around in prototype land and stop having to dissect all my projects to get the Arduino back just so I can start on my new projects. I want to use a microcontroller by itself!!!! 0.o

Before I jump ahead of myself I need to learn more about microcontrollers. Everything I read online is about PIC or AVR specifically, and why their better than the other >.<.... however I want a more vague description of what a Microncontroller is and how it works. I understand that many of them run on different architectures and configurations, however, (correct me if I'm wrong) most of them contain several different internal parts such as clocks, flash memory, ADC, ect, in common, and that's what I want to learn about.


QUESTION: Do you know of a book, article, tutorial, or other, that explains the interworkings of a generic microcontroller?


That's basically it. I don't want to pick between PIC, AVR, 8051, ect yet, I just want bare bone information. I COULD research each part by itself, and if you think I should do that, then I will, but if there's a place where all that wonderful information is all together...I think I'll pretty much be really happy about that exsiting...

 

 

Thanks in advanced,

-Thomas

P.S. If you have a specific recommendation on a particular microcontroller that I should focus on, let me know. I want to program in C however, so Picaxe is out of the question...

PICs, AVRs, Basic Stamp 2,

PICs, AVRs, Basic Stamp 2, PICaxe are all very popular. Basic Stamp has incredible support, PICaxe has flowchart programming and other stuff. PIC and AVR are similar, different stuff for different preferences.

Pic’s

I use PIC’s. Maybe because I have 3 different families available to me in mass quantities, or because im afraid of spoiling myself with a PICaxe or Arduino. Ive also dabbled in a little of the 8051 land but gave up because most variants dont have onboard oscillators and are generally more expensive.

I would suggest using pics if you are going to start going that way, Mass support everything you need a code example of is out there beleive me, plus all the design software is free!!! The programmers are very low cost generally less than 50 USD. There are pics with anything you could imagine on them, I2C, USB, A/D, PWM, EEPROM, Pullup resistors on inputs, just about everything. They are relatively cheap too, most mid range devices costing 1-2.50 usd.

Most modern microcontrollers are based on the “Harvard Architecture” which was developed by intel in the late 70’s early 80’s (1980 I think, its been a while since school).

Although I havent found any decent books pertaining specifically to microcontroller programming in C, there are many many books out there that will teach you the general idea. Btw most compilers use ANSI C which is the base of all C programming. Try not to get a book with C++ or any other variant as some functions may not be supported by all compilers.

Alright I’ve rambled enough, hope this gives you a decent start.

I felt as though a force was

I felt as though a force was pushing me towards using PICs…that or there’s just a heck of a lot more people using them, and a crap load more information out there. I just requested a book from my library ( and it’s cheap on amazon, I almost bought it before I thought to check the library) called: Programming and Customizing the PIC Microcontroller. You’ve probably heard of it. I think it might help, if not, then what the hay?

 

Thanks for the insight!

-Thomas

Dont be scared, code cant

Dont be scared, code cant hurt you, only the evil serial killer robot you put it in can. Just taje your time and dont be afraid to cook/break stuff, you only learn from your mistakes (although you soon forget what you learned and do it again).

I will also look into that book, my boss has been bugging me for months perhaps even a year now to learn C and rewrite the code for our products, even trying to bribe me, I need the cash so ill prob pick it up.

**Oddbot put it the best. **

Oddbot put it the best. What you decide to use may boil down to price. A recommendation would be to research what you are interested in and compare the cost of the chip and the programming software. I know with the PIC there are some free compilers out there for C and basic but they are code or line limited. With most of the AVR chips the software is free. For the 8051 you can use Bascom AVR to program it which happens to be significantly cheaper than software for the PIC micro. Also, consider the architecture that offers you the features that you are looking for. For me, I use a combination of PIC C from CCS, MBasic from Basic Micro, and Pic Basic Pro from Melabs. All of them have their pluses and negatives. The majority of my design work is done with the PIC. I have also used the Parallax Propeller for some designs as the chips themselves are reasonable and come with true multitasking cogs (it’l like having more than one micro on a single chip). Also, look for whatever examples and review material that is abundantly available to you. It would be very discouraging to plop down your money for software that you find difficult to use.

This is just my 2 cents.

That’s one of my concerns.

I understand what you’re saying about price. That is one of my concerns…However, I have no previous experience with microcontrollers except for the Arduino, so now I just want to learn the basics. Once I’m able to understand the basics I feel that I’ll be able to acknowledge the differences between different microcontrollers and then I’ll be able to, more accurately, determine which one is more appropriate for my application and price range. I’ll have to do some research…

 

-Thanks


Edit 01.19.09 1430

 

Wow. PICs are way more expensive than their comparable AVRs…that concerns me.

Idk…I’m starting to rethink things…

 

Why not try to get some
Why not try to get some samples of the procs? usually the companies will send you a couple…just need to have a non public(hotmailj, yahoo, google,etc) email addy so that you look like a real company…from what i’ve heard that is…

Here’s a good hint for you:

Here’s a good hint for you: go to the Microchip website and sign up so you can request some free samples. That’ll get you started. Some good PICS to start with are the 16F688 (18-pin), 18F4550 (40-pin), 16F877 (40-pin), and 12F683 (8-pin). Microchip also offers a limited free version of their C compiler (www.microchip.com). PicBasic Pro has a free version (www.melabs.com). CCS-C has a free version (www.ccsinfo.com). That’s a few for starters. Now, all you’ll need is a cheap programmer to get your code into the chips. Here is one from www.instructables.com - http://www.instructables.com/id/JDM2-based-PIC-Programmer/. There are a ton out there you just need to do a google search. You may find that the basic style compilers may be easier to learn versus the C compilers. Your mileage will coincide with what language you are most comfortable with using. SparkFun also has some cheap development boards/programmers that you should look into.

Also, as Oddbot said, I’ve found the PIC chips to be cheaper than the AVR chips.

Yeah…
Yeah I heard that too. Problem is I don’t have a non public email account. I tried to request free sample from microchip, but I was charged $7.50…I must be doing something wrong.

Nope, you’re fine. $7.50
Nope, you’re fine. $7.50 is the cost for shipping/handling. It takes about 1-3 weeks to get them.

microchip changed the way
microchip changed the way they do free sampleslast year. you now have to sign up for a business acount to get free samples. still all in all most chips are very low cost. the 16F887 is 2.20 in single pieces at microchipdirect.com shipping is 7.50 and they come 3 day air from thailand. also microchip hsan evaluation kit for the 16F887 which includes a programmer/in cicuit debbugger that can be used to program almost any chip they make via icsp. icsp is a 6 pin header that connects to the chip. the evaluation bord is 50 usd and has pads to jump to any thing you want to connect to it. the part number is DV164121. check it out as this is one of the best deals you can find on a decent eval kit from any company. we use the programmer at work to program our products.

Wow

That looks awesome!

the debug express is
the debug express is probably the way to go. it hs a plethora of I/o’s 38 to be exact. the debug express uses the 16F887 that supports in cicuit debugging so you can step thru your program if you have problems so you can see exacty whatsgoing on in cicuit. that chip is available in 40 pin dip. that is the chip im using in my first robot and probably any subsequent ones I build. it is a feature rich device with almost everything you need with the exeption of usb if you go that way. the programmer can be used with 97 percent of devices microchip makes. the other kit is for lower pincount devices but the programmer is the same just the eva board is different with a different family of devices. we developed our products at work on that very kit so it is very versitile and reusable. the eval board is 24 dollars by itself so its still kinda cheap if you get used to the form and layout of the board you can just pick up another board for your next project instead of cannibalizing a current design.

As long as I have ICSP
As long as I have ICSP functionality I don’t really mind what chip comes with the kit, I don’t plan on using it after I learn enough. It makes more sense to get the better chip though, especially for the same price, but after I learn I plan on using differnt chips and simply using the programmer…is that possible with the PICkit?

As long as the chip can be

As long as the chip can be programmed with ICSP which most if not all can be, that programer in the kit will be able to program it. Its a good investment both for learning and future programming needs. This link http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en027813 gives you a list of all te devices that the programmer supports. The 1st column labled Pickit 2 programmer is the column that you would need to confirm your chip selection falls under. Also Microchip periodically updates this list so if you find a device that isnt on it it may be soon. Generally the older decives may not fall under this category. Most of the older chips will/should have equivelents usually with the A suffix that are supported.

Thank You!

Haha. At this point in my PIC using carrer, I think that’s plenty of supported devices.

-Thanks so much for all of your help!

NP if you need any kind of
NP if you need any kind of basic code ill be happy to help. Delays, configuration of ports, A/D, EEPROM reading and writing if you get fancy. I havent really used servos so i dont have anything for that "yet". Thats my next obstacle to conquer. I also have pretty decent code for the SRF05 using a timer to count the pulse width (I was suprised at how simple it was to write, my 1st attempt worked perfectly.?. accurate to within 1 inch (2.4cm)). My bot now only uses 206 words right now and navigates almost perfectly with the exception of false readings on shiny floors.

Chips are nice but

Why not get a more complete devel/eval tool?

AVR Butterfly Digikey, $20 plus shipping, programming

MSP430 ez430-F2013 $20 plus shipping, develop on USB, low power

LPC2103 ARM7 Controller board $25, 32 bit, fast

 

I want to use PICs…Price

I want to use PICs…Price aside, I’m finding a lot of documentation and support for PICs rather than anything else, and as my first actual microcontroller, I want as much as that as possible. I’m definetly going to continue “shopping around” though. Thank you though, maybe I’ll look more into those as I continue to do some research.

 


The fact that the PICkit comes with some lessons/tutorials is a plus too.