View Full Version : Discussion PIC/Microcontroller questions
balesse
Nov 18, 2007, 02:29 PM
Ok, I would like to get setup with a microcontroller programmer such as a PIC, but have a number of questions.
- It seems like there are lots of projects using the PIC, so it seems like a good platform to start with. Are there any others that I should be considering?
- Why would I want to go for a normal PIC programmer VS a MPLAB compatible one vs a PICKit 2 setup?
- even if I get a normal PIC programmer, I'll still be able to use MPLABs as an IDE - it's just that the actual programing can be done through PMLABs, correct?
- Why would I want PICKit 2 vs an MPLABs programer?
I just want to mess around with some simple things that everyone else has already done to start with. RC Lighting setups (not that I really need a microprocessor for this), other LED projects, and some of the other projects I see around RCGroups and other sites.
I'm inclined to just buy a programmer to start with (just so I can get up and running without running into problems that I cause for myself.) I've done a few circuits and a couple of assembly programs back in school. I've got lots of other programming experience, especially in java, since that I what I do to pay for this hobby. :)
I know this is not a RC specific question, but most of my interest is around RC and this community is great for getting good answers.
Thanks in advance for you help!
Burton
phil_g
Nov 18, 2007, 03:38 PM
First off, you're going to get a lot of conflicting advice when you ask those questions!
There are a few professional users on here who use and will only recommend production quality kit, and amateurs like myself who get by perfectly well on cheaper development kit or even home made stuff.
You can spend as much as you like - there are some lovely all in one boards with LCD, keypads, speakers, RS232 etc etc, and on the other hand theres the humble JDM home-made programmer costing almost nothing and less then 2" square.
I've been using pics since they appeared, with a picstart 16B (obsolete), a JDM, a pickit1 and now a pickit2. The pickit1 board is nice, it has enough bits & bobs for a few experiments, eg 8 port leds, a breadboard area marked out for RS232, a pot for A/D, etc, but the programming socket is on board, ie its part of the programmer. I have one here in my hand if you need any more detail or a photo (nearly said a 'pic' then).
I like the pickit2 better because the programmer is 'remote' - ie when you build a project, you include a 6 pin header plug to which the pickit2 connects, and you blow the pic in-circuit. That suits me better as a lot of the stuff I design goes through many iterations of code and I dont have to keep removing the pic to stick it in a programmer.
I dont use MPLAB, I dont like IDEs and I've rarely needed the emulation facility - your brain is the best debugger. The instruction set is so tiny its easy to remember & for me its easier to read the code & visualise whats happening that play around with an emulator. By the way I'm assuming you want to learn pic assembler - I dont know anything about these pic basic or pic 'c' compilers - if thats your bag then maybe a stamp would be a better choice.
I'm not familiar with Atmel stuff, its human nature to like what you're familiar with, which for me is pics. Flash means no UV erasers, immediate reprogramming, superfast turnaround times (as in try it, doesnt work, spot an error, reprogram, try again - it works) and you have an array of A/D, timers, PWM options to play with.
Personally I'd recommend you start on the 12F675 as its so versatile, easy to build on stripboard and easy to fit into things, and to learn the instruction set & use assembler. Others will say differently. Your call!
The main thing is these things are fun to work with.
By the way you dont purchase pics - they are available for personal use as free samples from Microchip, you can usually order 3 lots of 3 types at a time.
Cheers
Phil
Tomapowa
Nov 18, 2007, 04:10 PM
For sure you will get a lot of "opinions" when asking such a question...
Depending on exactly how much you want to get into writing/programming... there are not-so cheap and the cheap options. You can write you own ASMs and compile to Hex and burn, where you can also buy BASIC or C compilers for helping develop the ASM code, ...OR... you can go the cheap route and use a PICAXE microcontroller (http://www.picaxe.com)... where you can buy one (12F629 with bootloader and BASIC-like interpreter) for around $5, including free programming software (BASIC-like language similar to the Basic Stamp... and downloaded to the PICAXE micro using a standard 9-pin com port and two resistors.. no PIC programmer required!). For experimenting/prototyping, I use the PIACAXE then when ready for production, I easily re-write (port) code using PicBasic Pro Compiler, generate ASM & Hex and burn onto regular Micro-PICs using my JDM-plus programmer.
As they say... "there are many ways to skin a cat"
(figure of speech of course... please no msgs from PETA or such... ;) )
octane-link
Nov 19, 2007, 02:35 AM
I will throw my 2 cents in here too. I use the PIC18F452 on a dev board from Peatman's book.
Its a great board, not very big, but it has a pot, an RPG, LCD screen, DAC, SPI/I2C, RS232. With this board, I have been able to run a servo with the pot as the input, and the servo head rotating (actually useful for testing); the servo can also run in a temperature control mode (not useful, just neat). The LCD can output a lot of information too.
Check out picbook.com, the site has all kinds of code and example programs there. My current project is to command the DAC to a voltage through the serial port using MATLAB. My next project is a telemetry system.
I use the MPLAB software, its fine for what I do. I do everything in C though, I hate assembly.
Like I said, my 2 cents, but you ought to check out that site I gave, its a heck of a resource.
Chippie
Nov 19, 2007, 03:11 AM
[QUOTE=octane-link]it has a pot, an RPG,
QUOTE]
O-L, what is an RPG ? (rocket propelled grenade? :p )
paulg
Nov 19, 2007, 04:04 AM
I agree with Octane-link. I use 18F series PICs and code in C (I too, hate assembler!!). There are various compilers available for free and an ICD2 clone can be bought on EBAY for about $40. These run under MPLAB and make debugging code fairly easy.
All down to personal preference though.
GavinBLDC
Nov 19, 2007, 05:18 AM
For PIC's the CCS C compiler is great if you don't want to spend too much time messing about with asm code, MPLAB sure helps, Hitech have a free PIC lite C compiler that does a few PIC versions. Microchip have the smallest micro if you are into tiny planes/models 2x3mm package.
AVR micros are easier to learn and the WinAVR GCC compiler is free.
Even the offical ISP is quite low priced. Plenty of DIY stuff too.
octane-link
Nov 20, 2007, 01:12 AM
[QUOTE=octane-link]it has a pot, an RPG,
QUOTE]
O-L, what is an RPG ? (rocket propelled grenade? :p )
Rotary Pulse Generator. I am not sure of its intended purpose, but its just for learning on this board.
Malc C
Nov 20, 2007, 05:13 PM
here's my 2p worth
You can get started for less than £15. Programmers such as the commercial JDM type are available from Sparkfun for around $12, or there is a commercial version of the GTP USB Lite (USB) for around £18. If you are able to etch and build your own PCB's then there are loads of schematics around for building your own versions. Add to this a solderless breadboard and obtaining some free samples from Microchip and you are well on your way. As for software, download MPLAB, PICpgm, WinpicPro or PicALL - all are free downloads.
As for programming, for Microchip PICs there is assembly, C, etc or high level planguages such as MBASIC, CHBasic and PicBASIC (standard and Pro). If you really want to get a complete package then have a look at the EasyPic4 system
http://www.mikroe.com/en/tools/easypic4/images/easypic4_500.jpg
This provides a programmer, development board, and programing language all in one and starting at $120
At the other end of the scale are the professional programmers / de-buggers, so you could invest a good few hundreds of $$ / ££ / Camels / groats / pieces of eight :)
The choice is yours
Jack Crossfire
Nov 20, 2007, 06:58 PM
PIC's had free samples. That's why I still use them. The Atmels are more popular nowadays and they have GCC support.
phil_g
Nov 20, 2007, 09:00 PM
The Atmels are more popular nowadays
That surprises me Jack, I dont think thats the case over here in Blighty - we only really have one electronics magazine now (EPE) & they cover mainly pics, simply because thats what contributors send in for publication... Elektor (European mag) have also done more pic articles than Atmel... I'd say use both, whatever suits a project best... in the 70's I learned on an equal mix of 8048, 8080, Z80, M6800, SC/MP & Cosmac1802, all with completely different architectures, addressing modes & instruction sets... I think its a mistake to say one particular type is always best, its horses for courses, although if you program in a high level language & you're not interested in its native m/c then I guess which chip you use is immaterial as long as it does the job. In that case I think I'd suggest going with the one that has the most 'community support', would that be Atmel in your case?
Cheers
Phil
meteor
Nov 21, 2007, 10:53 AM
I got into PIC's a few years back and I found a really good way to play with all the aspects is a little mini Sumo robot.
MiniSumos cover all the programming bases of I/O like sensors (A/D), motor control, program logic, etc. and are a lot more fun that a breadboard on your desk! :D
A really nice one is here: http://www.junun.org/MarkIII/ (I happen to have a spare, if anyone is interested!)
The one thing that no-one has mentioned is the JAL language, which I found very easy to use, and has a lot of great tutorials on the Net.
See: http://members.home.nl/b.vandam/lonely/index.html (this used to be a website, now he has compiled it into a book/e-book)
Just some ideas...
Richard Ingram
Nov 21, 2007, 10:07 PM
As Malc C said, the EasyPic boards (I have the EasyPic 3) are really nice for the money. I use Mikro C for the programming language. You can also use the board for any other programs that you can compile into a hex file. I have been dabbling with the PICs for quite a while and they are both powerful and fun to work with. The Atmel chips are very nice as well but you usually stick with what you start with.
balesse
Nov 21, 2007, 11:09 PM
Cool, thanks for all of the input. I'll think I'll start off with a basic pic controller and see how it goes from there. I might be back asking more questions later. :)
Thanks for all the input!
Oh, that EasyPic4 looks like quite the system - I would not know what to do with most of it. (Of course a year from now, maybe I'll want it.)
Burton
Malc C
Nov 22, 2007, 01:37 PM
The one thing that no-one has mentioned is the JAL language, which I found very easy to use, and has a lot of great tutorials on the Net.
True, and it has a good following. Maybe we should point Burton to the search facility as most of this was discussed in previous threads such as this one (http://www.rcgroups.com/forums/showthread.php?t=534408&highlight=JAL)
Oh, that EasyPic4 looks like quite the system - I would not know what to do with most of it. (Of course a year from now, maybe I'll want it.)
Burton
It basically allows you to program the PIC, test the operation of the PIC and debug the code without having to remove the PIC at all. The alternative is to use ICSP which uses wires from the programmer to the individual pins on the PIC and program it on the PCB or breadboard.
I too started out with a cheap programmer, but by the time I had purchased another programmer to handle 40 pin PICs, a solderless breadboard system, and suitable powersupplied I could of purchased a PicEASY3 at the time !
Wobit
Nov 26, 2007, 02:07 AM
Ive been playing around with micros (AVR and PIC) for a short time.
I would recommend trying the ATmega8 for starters. Why? Simply because it was about the same price as a pic12Fxxx at a local electronics store. The mega8 is a pretty 'powerful' chip, compared to the pic12,16,18.
I built a 'usbasp' (search google, its a in circuit programmer); it is a very simple usb programmer, that programs it fast. (when one has 1MHz< clock on an avr, and the slow sck jumper is not enabled. It uses a mega8, and some other components, making it cheap and 'easy' to build. You however have to have access to a working programmer, to program the m8 that goes on the programmer.
Additional reasons: WinAVR, and procyon's library <www.mil.ufl.edu/~chrisarnold/components/microcontrollerBoard/AVR/avrlib/>
and ofcourse, programmer's notepad that comes with the WinAVR installer package. This library is quite useful, and you just 'bolt' modules together, rather than having to figure out exactly how to do things. (Im sure there will be something like with a lot of useful modules in one package this out with PIC's, and if so could someone provide a link or a name of such?)
A warning: if you need to change the fuse bits eg in order to use an external crystal to make it run faster/more precise timing, i have yet to successfully change the fuse bits on an AVR using the usbasp programmer. Chances are that i stuffed up somewhere, but this 'stuff-up' can lead to a 'dead chip'. This happened when somehow i must have disabled the serial programming fuse bit. This can be undone, using a high voltage parallel programmer. The usbasp is not capable of undoing this change, if it gets to this state.
I too have built a pickit2, and but have yet to play around with pic's. I have just been building small projects others have made and provided source code for. I guess something that might be putting off is that one needs to use different C compilers for the pics: pic12, pic16, 18, 24...
The pics appear to have their fuse bits settings set in the code. This may mean it will be 'easier' to change fuse bits.
After 'graduating' from the mega8, or at least being more confident with micros i would give the pics a go. This is because it is likely that one will get samples from them (depending where you live of course!), and also because the higher power ones (16 bit ones) with larger amounts of program memory seem to be cheaper than equivalent AVR ones, well at least at the online shop i often look at.
I think the already mentioned GTP USB Lite programmer can program both PIC's and AVR's. Im not sure whether it can be used through MPLABS.
Robert
vBulletin® Copyright ©2000-2009, Jelsoft Enterprises Ltd.