EEV Blog Suggestion - n00b's guide to getting started in IC's - Page 1
Forum section: electronics / general

author: stormBytes
author_rank: Newbie
timestamp: January 30, 2010, 08:37:11 pm
content: Hello All,I'm very new to the world of electronics and microcontrollers - a 'late bloomer' of sorts. I'm really frustrated by the lack of clear, sensible and down to earth learning resources out there. I am referring to the PIC platform specifically, as I chose to start off with PIC and ASM rather then jumping into a compiled language. I felt this would provide a solid foundation in the inner workings of microcontrollers, hoping eventually to progress to a higher level programming language.The thing is, all the books out there may as well be written in chinese! I am of course grossly generalizing, but having invested my time in what has amounted (so far) to 'dabbling', I'm sure you can understand where I'm coming from.I thought it might be terrific for us n00bs if Dave were to dedicate an EEV episode offering guidance on how to get started learning electronic circuits and microcontrollers. I know a lot of people are going to tell me to just pick up an Arduino board, but I chose to take a more conservative approach and feel that PIC/ASM, at least initially, presented a solid opportunity. Contrary to general impressions, ASM isn't all that complicated! It's all of 35 directives and the trickiest part is learning to 'think like a computer'.I've tried the book route (and continue to do so) without much success. I think I can summarize my issues as follows, baring in mind that most books aren't limited to just one of these shortcomings:1. Many books deal with the 16F84 - a micro that's both out of date, hard to come by and relatively expensive!2. While offering a nice-and-slow initial introduction, many authors jump ahead of themselves without realizing they've left their reader in the dust!3. A lot of books are just a damned HARD READ! You'd think some of these authors majored in English lit rather then Engineering!Well that's it for my (initial) rant. It's nice to find and join this forum (I don't get why Dave doesn't promote the site more prominently on the EEV blog, I came across it incidentally!).Thanks for hearing me out, and I look forward to brainstorming with you folks!Cheers,DanielThis is of course merely a suggestion

author: Veramacor
author_rank: Regular Contributor
timestamp: February 01, 2010, 05:34:14 pm
content: Stormbytes,I wouldn't choose 16F84 as my first PIC. A real good mid range PIC that I am learning on is the 16F886 DIP Pin version (not the surface mount one). Its going to be around for a while and is pretty cheap (<$3US), has more memory (7K) , and more pins to play with.It comes in a 28 pin or 40 pin package and includes serial UART communication if you want to get into that. There are 16F pics that have USB capability, but speaking as an inexperienced individual myself I would shy away from that complexity.I've blown a few pics already, but at $3 a pop its not a big deal. I started out with parallax's basic chip, but they want FIFTY DOLLARS per chip.Dave mentioned Picaxe which is like Arduino as they have their own boot loader, but like you I wanted more ground level control of the pic.I've tried Great Cow Basic which allows you to compile .hex files for free, but I found that limiting. What I really love is Oshonsofts PIC Simulator IDE (for pic16F)http://www.oshonsoft.com/index.htmlIt lets you write in basic or ASM, simulate the program and compile .hex files. You can try it for free I think for 30 days.Here is my El-Cheapo setup:$13 icP01-V1 Programmer fromwww.piccircuit.com$40 PIC Simulator IDE$3 PIC16F886$10 breadboard.$ x number of radiohack resistors, caps etcBruno has some kick ass pic project examples here,http://www.micro-examples.com/public/microex-navig/doc/200-pic-microcontroller-examples.htmlbut he uses a micro electronica development board.Developments boards are cool and have lots of bells and whistles, but I do like to just be able to have a breadboad, pic, resistor and led to start learning on.If you already have the 16F84, here is a site I've referenced ...http://www.users.globalnet.co.uk/~jchap/tvpropi2.htm

author: stormBytes
author_rank: Newbie
timestamp: February 01, 2010, 06:09:16 pm
content: Veramacor,Thanks so much for the helpful insight. Actually, I was sort of throwing darts in the dark. I picked up an EasyPIC6 development board (not much good at my level) and spent a good deal of time reading tutorials and ebooks only to drop most of them half-way in for one reason or another. Some are too advanced, others have obsolete code. Lately I've been hacking away at Gooligum's tutorials. These are pretty good. He kind of skims through a lot of the material and forces me to catch up on my own, but all things being equal, its the best resource I've yet to find.I did pick up a breadboard as well as a standalone ICD2 clone. This should help me through ASM debugging, or at least so I'd hope. As for chips, well.. I'm at the mercy of whatever chips are used in the tutorials. There's no point to buying a chip with a complicated novice-unfriendly (pronounced "pro") datasheet. Gooligum's site focuses (at least thus far) on the PIC15F509. While I don't have the chip, I'm trying to follow along as much as I can using the MPASM Sim utility to cycle through the code.Ughhhh this should definitely NOT be THIS frustrating! There should be a video tutorial series for beginners to follow along, just enough to get on their feet! In fact, if I make it through this, I might actually record one! I think it'd ROCK if Dave gave the matter some thought. He's got a terrific, down to earth way of explaining things. I think he'd be a rockstar!Okay... done with my rant. Back to my frustrating learning materials!

author: Veramacor
author_rank: Regular Contributor
timestamp: February 01, 2010, 08:36:47 pm
content: Best Newbie Electronics YouTube Tutorials ever,That is lesson One of about 11 videos of how to use EAGLE pcb. At some point you are going to want to make a board, and Cadsoft Eagle is pretty popular design package. You can download for free if you don't already have it, but there is a steep learning curve.Jason from RPC electronics was kind enough to make very good Tutorials on Eagle.I make my boards now using a home built CNC router, but I was blown away to see that RadioHack STILL sells PCB board Etchant. You will find breadboarding gets real messy once you have a cool idea working. All those jumper wires start getting annoying pretty fast!

author: stormBytes
author_rank: Newbie
timestamp: February 01, 2010, 09:51:53 pm
content: I've come across Eagle but it looked to me like a professional engineering platform. Steep learning curves are pretty much the norm where that's concerned. If you don't mind my asking, how (or rather, what for) do you use Eagle? Are you a hobbyist or pro? Also, might you elaborate a bit on the use of a "CNC router" for etching PCBs? I googled it, even youtube'd it, all I was able to come across were some woodworking stations.Would love to hear more!

author: badSCR
author_rank: Contributor
timestamp: February 01, 2010, 10:42:59 pm
content: I have tried the ASM route for PICs, butIcouldn't do it.For me, it was easier to do in C. I am not a pro but I can craw a little.What I started with is:"Sama Teach YourselfCin 21 Days" ISBN# 0-672-32448-2 its more for PC but the basics are the same."Beginner's Guide to EmbeddedCProgramming Volume 1 " ISBN# 978-1438231594 (PIC16F690)Microchip PICkit 2 Starter KitBoth books are good, easy to read and down to earth.

author: charliex
author_rank: Frequent Contributor
timestamp: February 01, 2010, 10:59:20 pm
content: I found eagle really easy to pick up, i like the command line interface for instance. Some things are a bit odd, like copy/cut/paste but there are loads of videos and tutorials covering the oddities.Work uses protel but i find it to be a bit cumbersome, though like anything good its complex and needs the time invested. Eagle is an arduino, protel is an ARM/x86/insert cpu of choice herecnc router is a CNC machine that cuts PCB's instead of wood, they're not that cheap really. you can see some videos of mine here,

author: armandas
author_rank: Frequent Contributor
timestamp: February 01, 2010, 11:42:24 pm
content: Quote from: charliex on February 01, 2010, 10:59:20 pmLet's not confuse the sh*t out of a beginnerEagle is not the best design tool, but it has a free version, works on Windows, Linux and Mac. That's probably why it is loved by hobbyists and that's why you'll find a ton of tutorials, libraries and "stuff" for EAGLE.Regarding CNC, you might want to have a look at a discussion on this forum:https://www.eevblog.com/forum/index.php?topic=142.0

author: rossmoffett
author_rank: Regular Contributor
timestamp: February 02, 2010, 06:35:35 am
content: I think it's a bit strange that you say you want to start with a solid foundation of microprocessor fundamentals by learning ASM.. and asking Dave's advice.. because he's already given it in his video blog about the Arduino. Because they're so cheap it's pretty useless to bother with saving memory and processor time except in the most cost-critical applications.That being said, if you want to do it anyway, I think it might help you to start with a firm grasp of digital logic and CPU theory before you try to jump into ASM. Otherwise, a lot of those concepts will be very confusing and hard to grasp. With a firm bed of digital logic, all of the ASM logic makes perfect sense. The high level languages are an abstraction and very little of that base level knowledge is necessary.. which is what makes the Arduino so awesome. I hope you don't discourage yourself, because while the Arduino provides instant results, learning ASM is a long and hard journey (I still don't know it too well.. I skipped it after digital logic and went to programming in C/Java).

author: charliex
author_rank: Frequent Contributor
timestamp: February 02, 2010, 06:56:23 am
content: Quote from: armandas on February 01, 2010, 11:42:24 pmindeed, it's the arduino

author: Veramacor
author_rank: Regular Contributor
timestamp: February 02, 2010, 01:10:31 pm
content: Stormbytes,Eagle is a CAD-like program that lets you design circuits and lets you lay out real world components onto a printed circuit board. The primary mention of Eagle is that there is a fully functional FREE version of it. The only limitation is the board size. I cant remember if its 3" x 4", around that size. That is big enough for the vast majority of hobby applications.You can forgoe making your own boards if you just want to fool around with circuits. A nice breadboard is all you really need if you want to just learn. Id thought I'd just throw that out there because the resource was free

author: Chasm
author_rank: Regular Contributor
timestamp: February 02, 2010, 03:06:10 pm
content: Quote from: Veramacor on February 02, 2010, 01:10:31 pmThe board size is limited to 100 x 80 mm (4 x 3.2 inches).The board is limited to two signal layers.The schematic editor can only edit one sheet. (Which is pretty much unlimited in size. So this is mostly a problem when it comes to printing the schematic.)No time limits, for non-comercial use only.More information on thecadsoft site.There is a student version of Altium Designer, but that requires not only registration and confirmation as student but also IIRC 90 Euro + s&h for a 1 year time limited version.

author: stormBytes
author_rank: Newbie
timestamp: February 02, 2010, 03:07:28 pm
content: Quote from: rossmoffett on February 02, 2010, 06:35:35 amYou think it's strange that I'd want to learn fundamentals by starting out the ASM route? What's so strange about that? In fact, that's probably the only way to go! When you write code in a compiled language, you're working through an interpreter. You have zero direct control over what goes on in the micro. Despite that, this isn't really about low level control as much as it is about an education. I believe that having a fundamental understanding of micro's and how they work (ASM/MPLab 'stepping in', seeing the registers update, etc) is essential for anyone wanting to develop embedded systems of any sort. Again, just my own view on the matter.In this regard, Arduino's a cheap shot. In fact, I don't even see the difference between developing in the Arduino platform or going the PICbasic route (aside from the interpreted/compiled technical differences). If all you want to do is make an LED blink, or assemble some home-made gadget, then sure, by all means go the Arduino route! But if you're looking at broadening your development spectrum, there is no path of least resistance I'm afraid.Quote from: rossmoffett on February 02, 2010, 06:35:35 amWhich is precisely why every entry level book or tutorial starts off explaining processor basics like bits, bytes and registers, logical states, etc. Rather then going about it a mere theory, these fundamental concepts are interweaved with ASM directives, making for a more practical (and tenable) learning method.Quote from: rossmoffett on February 02, 2010, 06:35:35 amI'm not discouraged at all. I never thought it'd be a walk in the park. Progress, I must admit, while slow and painstaking, is nonetheless palpable. Sometimes I go through the same tutorial (12 pages or so) for 2-3 day in a row before things finally 'register', no pun intended. Often I try out the code, observe the results in the simulator's watch windows to (hopefully) get the picture. But, that's the cost of doin biniss.

author: Murphy
author_rank: Regular Contributor
timestamp: February 02, 2010, 04:56:44 pm
content: I've been doing the same thing for the past couple months or so with a PICKit 1 and a handful of 16F630s.ASM on a mid range pic is a great place to start. Even if you switch to C later, knowing how the chip works in assembly will make writing good C code much easier. Also, since you can step through your code in the simulator it's probably easier to debug.Books aren't really that necessary, the PIC datasheets are excellent and there's plenty of good info on the net. The biggest hurdle is really just learning how the micro is working and how to set up the the peripherals. After that its all just learning the ASM instructions and how to use them to do stuff.However, looking for an answer to a certain question I stumbled across "CRC Press - Microcontroller Programming: The Microchip PIC" which seems very good.http://books.google.com/books?id=VXZJEqnCGfQC&printsec=frontcover&source=gbs_navlinks_s#v=onepage&q=&f=falseJust do incrementally more complex programs and read the datasheet to figure out how (and google if you cant figure out how to make the code do something). That way you're working at your own pace and learning more than if you were just copying someone else's code from a tutorial.Make an LED blink, drive a 7 segment display, 2 7 segment displays, 3?, make a timer count up in real time, make a clock, alarm clock, pick up some LCDs and make them work, etcWhat kind of chips/programmer are you using?If you want, send me an IM. I can probably help with any problems you have.

author: charliex
author_rank: Frequent Contributor
timestamp: February 02, 2010, 05:24:48 pm
content: I don't recall Dave giving the advice not to learn ASM, just not to turn into one of those guys who it becomes the be all and all, though thats the same for any langauge really.. if you find yourself saying , i can write that faster in ASM than C, you'd be that guy, unless its hello world, and its on a cpu you know the opcodes off by heartEven in something like C you often need to learn things to work on interrupts, memory management and IO that still need ASM too, so its well worth learning it. Lots of compilers have add ons and keywords to allow you to do a lot of the direct chip stuff. Learn it, understand it, and then use it when or if needed.Having worked with a lot of programmers, if there is one thing that Dave's said I can whole heartedly agree on its that hardware people make better programmers. They're just more rounded, and the same goes for software people who know multiple languages including asm. But some programmers don't even know what an interrupt is, and they'll never use one. Some C programmers have never heard of the volatile keyword, and don't know what it is used for, or things like "const volatile" make sense, but they'll never need it either, and they can use practically every feature of C++ that exists.Its tough to master it, but you don't need too, get the basics figured out, then use C or something. ASM just isn't that complicated to learn, its just an akward syntax.Anyway best of luck!

author: rossmoffett
author_rank: Regular Contributor
timestamp: February 02, 2010, 07:47:28 pm
content: Quote from: charliex on February 02, 2010, 05:24:48 pmYes, ditto.Quote from: stormBytes on February 02, 2010, 03:07:28 pmMy way of saying that was inappropriate for what I'm trying to communicate. I'll get to the rest later..Quote from: stormBytes on February 02, 2010, 03:07:28 pmI hope not, I use one.Quote from: stormBytes on February 02, 2010, 03:07:28 pmThere's not, it's just a cheap development platform with a lot of support, and easy-quick start guides. You can get into the thick of things with Atmel chips through the Arduino IDE too, most projects in the net don't because it's trivial to use it without ASM and memory management.Saying that the Arduino is for blinky lights and etc. is a cheap shot. It's much more sophisticated than that and it is the path of least resistance IMO. You can start simple with blinky lights, serial comms, controlling displays and etc and you can mix in ASM commands or memory management as you progress.. at least that's what I'm doing. There's a lot of BS on the net from hardcore ASM programmers and hackaday readers, don't buy it. It's a front-end for the AVR microcontroller, which supports fully AVR ASM if you choose to use it. You can do it in tandem with GCC commands, or with no GCC commands at all. It's a programmer with a lot of extra features. I appeal to you to read the literature available for it before spreading what you might have heard about it from others, and make your own assumptions. The haters out there are only pissed off because newbies are coming onto the scene and doing the things that they struggled for years to do in only a few minutes - that doesn't make it a toy any more than a MacBook is a toy because it's easy to use.Quote from: stormBytes on February 02, 2010, 03:07:28 pmI don't know which books you're reading, maybe you found some better stuff than I did. The digital logic explanations were very cursory and difficult to grasp on their own in the stuff I've found. The documentation of things like that is much more thorough in digital logic books which makes it easier to grasp, then later when you look into ASM documentation you're looking at a review instead of totally new concepts before you learn the ASM stuff. That's why my suggestion to you is that if you wanted to learn ASM, which I have no problem with whatsoever to be clear, your best bet is to learn some digital theory first so that you're taking things in small bites. So my response was two part, which I would sum up as:Because you are "really frustrated by the lack of clear, sensible and down to earth learning resources out there" you may find that you might in fact like the green eggs and ham (arduino) after all, and it might meet the desire that I supposed you could have to start with easier, more documented things before getting into the thick of ASM. (I take it that this is not the case)If you would like to learn ASM regardless of the above, I think that it would be easiest to study digital logic before progressing to that, because you'll have to learn it in the course of ASM programming anyway and this way you're not trying to learn two things at once. You'll open up the ASM books with a full understanding of all of the components in a microcontroller, rather than learning about them as you learn the individual ASM commands and architecture, which can make things very confusing, like:QuoteIf you feel differently, that's fine, I'm not telling you what to do, please take no offense. I'm trying to help you by giving my advice based on the years I've spent in college and in my hobbies learning electronics.

author: comox
author_rank: Regular Contributor
timestamp: February 26, 2010, 06:27:25 pm
content: If you wish to bypass the PIC16 family and simply start with the PIC18 family, I can recommend a most excellent book called "Applying PIC18 Microcontrollers" by Barry B. Brey. This is book is written by a university prof for use in teaching a course on microcontroller programming and interfacing. It starts off with an introduction to the PIC family and architecture and then jumps right into assembly. It evenually moves onto C and interfacing, but early chapters stress assembly and the instruction set. I have spent 100s of $$$ on PIC books, and sold the ones I didn't want or need. This is one I have kept and I highly recommend it.That being said, I'd rather get hit by a bus than code in ASMI do all of my development in C using Hi-Tech Software's PICC18 Pro. My applications are so big that if I attempted ASM, they would never have made it through to production.I would also recommend giving Labcenter Proteus a go. I believe they have an evaluation version (Proteus 7 Demo) which should allow you to create simple uCU circuits, upload code to the uCU and run in emulation mode.

author: A-sic Enginerd
author_rank: Regular Contributor
timestamp: April 05, 2010, 08:14:41 pm
content: I know it's been a month since the last reply, but with the volume of stuff to learn I'm sure you're still looking for insights.I skimmed the bulk of the responses and I'll throw my $0.02 in.In some respects, I'm feeling your same pain. Recently getting into the hobby side and picking up PICs, but the last time I used one was senior project for my BS and that was like 15ish years ago. Things were a lot different.Personally, I think the bulk of your confusion and frustration is due to the nature of what you're trying to grasp. I think if you break it apart and look at each of these things in their own light, then it starts to come a little easier as to how all the pieces fit together:- What's the architecture of the cpu like and how does it work? NOT the controller as a whole, just the cpu.- What's the ASM language like and how does that work with the cpu? (sounds like you're getting a good handle on all this part, and yes it goes hand in hand with the prev bullit)- How does the cpu interact / work with the hardware around it? In this case I speak generically - not just the cpu in a PIC, but any cpu.- How does this peripheral hardware itself operate? (e.g.: how does a UART function, or an ADC, etc.)- How do I write code (asm or otherwise) to get the cpu to interface and drive all this extraneous hardware?- then on top of all that you have the specific tool environment, which has a learning curve of its own. But if you have all the other things handled, this will come more naturally and it will be a matter of just learning its specifics.When learning all this sort of stuff in college, I was learning each piece in its own light. Had programming classes that were all about strictly programming concepts (speaking higher level languages and platform independent here). Had an ASM class to learn how machine code looks and works with the architecture of a CPU. Had a class called "computer interfacing" which was learning all about how to write code to have a cpu drive all its periphery hardware (in this case it was all in ASM). Then in parallel with all that I had some digital logic classes. It was at the tail end of my Advanced Logic design class that we got our first taste of a u-controller. But by that time all the foundation had been laid so it was a matter of just learning the specifics of what hardware was on the controller and how those specific tools worked (cross compiler, assembler, linker, etc.).So my advice, to avoid getting too frustrated - realize you're dealing with multiple things at once and to look at them in their own light first before trying to figure out how to put it all together.As to the whole thing about hardware people making better programmers......errrrrr.....I won't say that statements wrong, but I won't exactly agree with it either. Depends on what's needed. I don't think I'd want a hardware engineer that's had a couple C classes working on the code the bank uses to manage my bank account.

author: Simon
author_rank: Unknown
timestamp: April 06, 2010, 11:32:17 am
content: I use mikroe basic although many prefer C over basic, I found assembly just too daunting and having built a dynamo controller with a pic that works fine in "real time" I can't see the issue with not using assembly. I started on the 16F88 but quikly changed to the 12F615 for most projects as it is as powerful almost as featured as other pics butr smaller and much cheaper, I'd go back to the 16F88 for bigger stuff or just use a simple 18F' pic.

author: Zad
author_rank: Super Contributor
timestamp: April 06, 2010, 10:27:09 pm
content: There is a whole huge mythology about assembler. This makes people think "oh my god, assembler, that's really difficult, I will never learn it" and so right from the start their brain thinks it is difficult. Now, admittedly I was weaned on the Z80 and 6502 in the 1980s, and then the 68000 etc, but I learned PIC assembler just from reading the Microchip data sheets. Honestly, I am no genius.They tell you exactly what instruction does what, and how to talk to the integrated peripherals. Incidentally, pretty much the only difference in the main PIC range is the memory and peripherals. They share the same core code and method of operating. There really is not that much difference between a 16F88 and a 16LF683. Just think of it like a car. A 1988 Ford Fiesta 1.1 still drives the same way as a 2010 Fiesta 1.8. The new one just has leather and aircon, but all the controls are the same.Don't forget that it is in the interests of the people who write these books to stretch things out, and make you, the purchaser, believe their way is the best way of learning. Even if you jump to 'C', you will still have to learn how the memory and peripherals operate. The important thing is to actually _do_ something. Use the chip, the assembler, the loader. Honestly, it is so much easier to actually get down and use the thing than it is to read half a dozen books and get confused by 6 different ways of telling you the same things.In short, whatever chip you have, go to the manufacturer's web site, download the main document, print it out if possible, and read it!

author: Simon
author_rank: Unknown
timestamp: April 07, 2010, 06:59:56 am
content: Well when it comes to programmng I am a bit "thick" I spent two years trying to "assemble" bits of knowledge scattered around the web on assembler and got no where, in a day I had a flashing led in Basic. I gave up on books, I never bought exspensive books and the cheaper ones were written by people who had no intention of helping you but just lining their own pockets, how can an author who writes about every single hobby you could think of write about pics ? chances are the guy was not even into electronics nfact he made a right mess of everything, naturally play.com got a glowing hot review from me of the book and I resold it on ebay to someone that was unfortunate enough to think he got a good deal: well ok a fiva for a bo0ok written by someone eho thinks he is funny and forgets to write about the subject at hand might be amusing for some.Since I have made a few pic projects including a regulator for a dynamo which handles the dealiong with real time events fine despite beng written in basic.