Absolute beginner interested in learning to use microcontrollers  - Page 1
Forum section: electronics / general

author: Paradoxine
author_rank: Newbie
timestamp: November 11, 2012, 12:29:20 am
content: So for a project I want to do, I'll need to use a micro-controller. Not a particularly complex circuit mind, and indeed I could get away with doing it with some more basic components but it'd be far more work and cost more in addition. Anyway, I'm currently in (UK)College and would like to learn to use PIC micro-controllers (material is easiest to find). I have found the following books:http://www.amazon.com/PIC-Microcontrollers-Know-All-Newnes/dp/0750686154/ref=sr_1_7?s=books&ie=UTF8&qid=1352591966&sr=1-7&keywords=PIC+microcontrollerhttp://www.amazon.co.uk/The-PIC-Microcontroller-Introductory-ebook/dp/B0014D4R1K/ref=cm_cr_pr_product_tophttp://www.amazon.com/Designing-Embedded-Systems-Microcontrollers-Edition/dp/1856177505/ref=cm_cr_pr_product_topI'd appreciate it if you guys could give me any advice and or suggest any alternative material. I don't mind learning assembly, but not just for the sake of it, at least not at this point when results are more important. I have ample experience in C++ so using C won't be too much of an issue, apart from learning the necessary API etc. Unfortunately, I don't have much money either, so buying multiple (expensive) books is probably not possible.Also, any good free online guides would be much appreciated.At this point I'm tempted to just jump down into hell, buy a kit and then just google relentlessly until I know enough to get by. I'd prefer getting a more rounded knowledge base though.

author: montcler
author_rank: Contributor
timestamp: November 11, 2012, 01:00:05 am
content: Hello,There are plenty of books (C, assembly, Basic) you can download them in PDF through the network.Simply search. Luck!Greetings.

author: croberts
author_rank: Regular Contributor
timestamp: November 11, 2012, 01:53:09 am
content: HelloLately, I do a lot of design and programming with the PIC16F690. I use microchip's free MPLAB IDE to write and compile code and to program the chip. I use a PICSTART Plus programmer and DIP versions of the chip. I do all assembly language programming. I am currently using the chip to control the LED lighting system I designed for my home (see Topics "Solar Powered LED Lighting System","LED Light", and "LED Driver" in the Projects, Designs and Technical Stuff section). I use the plain MPLAB IDE (I think they are on versionnot MPLAB-x (might be great I just haven't used it). I hope this helps you get started. Let me know if I can help you get a project started.

author: Paradoxine
author_rank: Newbie
timestamp: November 11, 2012, 02:31:14 am
content: Quote from: croberts on November 11, 2012, 01:53:09 amThanks for the reply, I think the first step is to know exactly what I'm dealing with, so even just stating what it is you use is very helpful. I just recently found a Pickit3 PDF user guide and it may be just enough for me to get started.

author: dr_p
author_rank: Frequent Contributor
timestamp: November 11, 2012, 02:47:14 am
content: I started with PicKit2 and the tutorials fromhttp://www.gooligum.com.au/tutorials.htmlwhich I found to be excellent. They used to be free, now only the baseline ones are. I chose the PicKit2 programer because I wanted everything to work together on the first try - MPLAB, compiler, hadware. There are also some useful tutorials on the CD that came with it.Gooligum also sell a training board that goes hand in hand with their tutorials, but you still need a programer.You might want to stock some cheap PICs for all those tutorials - 10F200, 12F509, 16F505, 16F629, 16F684, 16F690 (included in PicKit2).

author: johnboxall
author_rank: Unknown
timestamp: November 11, 2012, 04:04:15 am
content: Quote from: dr_p on November 11, 2012, 02:47:14 amhttp://tronixstuff.wordpress.com/2012/10/25/review-gooliegum-electronics-pic-training-course-and-development-board/It's a very good learning environment. Cheaper than just buying a book in some cases. David has also released a few more tutorials.

author: notsob
author_rank: Frequent Contributor
timestamp: November 11, 2012, 04:23:33 am
content: There are also some PIC tutorials on pcbheaven.com

author: hlavac
author_rank: Frequent Contributor
timestamp: November 25, 2012, 02:37:58 pm
content: C? Too bad, the free compilers for PICs are crippleware.You would be better off with 8bit Atmels (ATmega etc).Winavr gcc is full featured without silly limits, and 8 bit PICs kind of suck in comparison with 8 bit AVR even before they are crippled by not using the instructions that help C programs most.

author: hlavac
author_rank: Frequent Contributor
timestamp: November 25, 2012, 02:43:35 pm
content: Anyway, considering that ARM is coming to low end very soon it may be pointless to invest in learning an architecture that will be obsolete by the time when you are finished learning...

author: Kremmen
author_rank: Super Contributor
timestamp: November 25, 2012, 09:27:09 pm
content: My suggestions:1 Atmel AVR and AVR Studio- As common and as many variants as PIC- Some say (me included) the internal architecture is more... shall we say orthogonal, and supports higher level languages better. Not a big deal but anyway- 32 bit chips available if you need more oomph- AVR Studio is uncrippled freeware; dead easy to install and to start coding. Comes with full gcc toolchain containing all you need. Same toolchain is usable for all Atmel chips.- Studio supports C++, and it is the same compiler you use on your PC (or very close, AVR-gcc variant)2 ARM Cortex (M3 or M4)- ARM - can you get more standard than that? Everyone and their cousin makes chips- Definitely programmable with high level languages- 32 bit horsepower and >100 MHz clocks when you need it. Not to mention HW floating point in M4F- For TI chips there is the free version of Code Composer. Sure, it is crippleware - max 32kB executables but that will get you up to speed.- For Atmel SAM chips the Atmel Studio is available uncrippled and free- With a bit of work there are many free uncrippled toolchains for ARMs of all kinds, especially if you do Linux

author: nctnico
author_rank: Super Contributor
timestamp: November 25, 2012, 09:43:14 pm
content: I wouldn't choose Atmel. They like to lie about the specs. On an inherited design someone choose an Attiny to run at 1.8V. It turns out the device cannot run at 1.8V reliably even though the datasheet says it should. Fortunately the design could be fixed by adding an extra 2V regulator but it does add extra costs on a medium volume product.

author: Psi
author_rank: Super Contributor
timestamp: November 25, 2012, 11:02:59 pm
content: Strange, i've run tinys at 1.8V with no issues.But i agree with above, as much as i love AVR's there isn't much point getting into them when ARM is so close to replacing the low end MCU market.If you want something easy to learn look at the Arduino, if you want something to teach you a good platform which will be around for ages, choose ARM.In reality it doesn't matter so much as programming skills transfer between platforms pretty easy.So if you really want to learn PIC, go for it.Don't get forced to pick a different platform just because others say so.The most important factor is that you enjoy it and your more likely to give up when things get hard if you're using a platform someone else recommended and not the one you really wanted.Also, don't learn ASM unless you actually want to or are interested in it.Its nice to understand ASM and how things work at that level but its not required.Use C, it makes things much easier.

author: Kremmen
author_rank: Super Contributor
timestamp: November 26, 2012, 09:09:23 am
content: Quote from: nctnico on November 25, 2012, 09:43:14 pmAtmel _likes_ to lie? Bullshit. Maybe i am easily pleased but of my numerous applications of Atmel chips, i have yet to fail in a single one. I find Atmel documentation generally satisfying or better, although they too employ human beings capable of mistakes. At least they have responded every time i have requested support, and every time the issue has been resolved.Don't make an isolated problem into a general feature of a manufacturer's entire offering. Atmel processors can be found all over the place - not likely if they were in the habit of failing.Anecdotes like yours have the problem that we have no idea at all where the true root cause of this particular problem might have been. Having seen this kind of complaint so many times, my bet is an incompetent implementation creating the problem at such low supply voltage. There is a general tendency that the more skilled the worker, the less broken the tools are.

author: AlfBaz
author_rank: Super Contributor
timestamp: November 26, 2012, 03:03:19 pm
content: I'm sure most vendor forums are the same, but i can only speak for microchip forums, they are filled with lots of people willing to help. Just make sure you know what RTFM means

author: chrome
author_rank: Regular Contributor
timestamp: November 26, 2012, 03:35:33 pm
content: Quote from: Kremmen on November 26, 2012, 09:09:23 amProbably a too high a clock on that low a voltage or they chose another version of the same AVR but different specs.

author: 8086
author_rank: Super Contributor
timestamp: November 26, 2012, 04:01:52 pm
content: Quote from: hlavac on November 25, 2012, 02:43:35 pm

author: nctnico
author_rank: Super Contributor
timestamp: November 26, 2012, 08:25:59 pm
content: Quote from: Kremmen on November 26, 2012, 09:09:23 amIf you read the specs for the attiny carefully you'll see the brown out detection (POR) trips at 1.78V. That is a 20mV margin. Ridiculous! The problems occured when trying to program the internal EEPROM. Real 1.8V controllers like NXP's ARM controllers have their POR trip at 1.65V which is a margin of 150mV when operating from 1.8V. I've contacted Atmel's support but in the end they had to admit the device wasn't suitable for use at 1.8V. It works DOWN TO 1.8V but not AT 1.8V. Your milage (luck) may vary but the numbers speak for themselve. If a manufacturer tries to make their parts look better than they are I rather avoid them than taking the chance of discovering another gold plated turd. If the datasheet says a part works at 1.8V it should work at 1.8V in a real world application which means the actual voltage may vary 3%. I want to be able to rely on the key features without having to read the fine print on page 3175 of the user manual.

author: ptricks
author_rank: Frequent Contributor
timestamp: November 26, 2012, 09:11:03 pm
content: what do you see yourself doing in that field in the long term ?If you are going to work mainly with peripheral type products like mouse, keyboard, usb gadjets, things like a controller for a microwave, television, automotive sensors etc then PIC or AVR will work fine and is a great starting point. If you go the microchip site and register you should be eligible for free samples, so that is a bonus as well.The mplabx ide is free and the compilers like xc8 are limited by optimizations in the demo version. Nothing that should impact learning the chips.If you are going to be designing products where every function depends on the MCU in things like smart phones then PIC and AVR are not what you want, look at ARM or Mips.When it comes to pic books find some by Lucio Di Jasio , of the books I have read, the ones he writes on the PIC are the easiest to understand and he now works for microchip so you know the content is on target.Some other languages options besides commercial programs are C, JAL and Basic, all are free.JALhttp://www.casadeyork.com/jalv2/Basichttp://gcbasic.sourceforge.net/http://www.sfcompiler.co.uk/swordfish/Chttp://sdcc.sourceforge.net/

author: Kremmen
author_rank: Super Contributor
timestamp: November 26, 2012, 09:19:00 pm
content: Quote from: nctnico on November 26, 2012, 08:25:59 pmIn your case it seems to be a question of the acceptable margin where you and Atmel had different opinions. I don't have any need to defend Atmel so if that was a failure for you then it was so and Atmel's part didn't meet your expectations. Maybe i have never run into these kinds of problems because as a rule i design defensively. One part of that principle is never to use the extreme min/max values of any spec. Unless you really need to, and then that spec becomes the critical one and you do need to read to page 3175.If the ATTiny didn't meet your expectations - fair enough, but saying that Atmel (or any other mfg) falsifies its specs as a rule is a bit unfair, don't you think? The net is full of those who shoot from the hip and it tends to say more of the shooter than of the target.