
Electronics Forum |
![]() ![]() ![]() ![]() |
Welcome Guest ( Log In | Register ) | Resend Validation Email |
Pages:12 ( Go to first unread post ) | ![]() ![]() ![]() |
CPW1992 |
Posted: February 01, 2006 12:01 am
|
Newbie ![]() ![]() Group: Members+ Posts: 18 Member No.: 3,850 Joined: December 16, 2005 ![]() |
When it comes to learning how to use microcontrollers, MANY people have absolutely no idea how to start. I had this problem when I began and I have had other people PM me and ask me about it, too. Here is some information that should help you begin:
Here are the steps in programming a microcontroller: Step 1. Write the code. To write the code, you will need to find an IDE (integrated development environment) that is easy to use and supports the language you want to use. The most commonly used languages for microcontrollers are probably C and BASIC. I program in BASIC and therefore I don't know much about programming microcontrollers in any other language. I would suggest writing the code in BASIC, as it is quite simple. I downloaded an IDE for use with BASIC, and it makes things really quite easy! Here's the link: Proton IDE Lite Step 2. Compile the code into assembly code. No matter what language you write the program in, the code will have to be turned into assembly code eventually. You can write the assembly code right from the start, but I do not recommend this as it is somewhat difficult if you are just beginning. To compile the code, you will need a compiler. Most IDE's (such as Proton IDE) come with a compiler, so this step is fairly easy. Look in the help file of the IDE for specifics on how to use the compiler. Usually you just have to click a button, and the IDE will create an assembly file (.asm) in the same folder as the code file. Step 3. Assemble the code to create a .hex file. After you have written the code and compiled it, you will need to create a .hex file that the PIC microcontroller can use. This is done using an assembler. The Proton IDE comes with a built in assembler, but sometimes you may need a separate assembler (if your IDE doesn't come with one). A good one to use is the MPASM Assembler. Step 4. Load the code onto the microcontroller. This is done through an interface board called a programmer and an application that can send information to the programmer. With this application, you open the .hex file you created in Step 3. Then, as long as the programming board is connected properly, all you need to do then is click a button and the program will be loaded onto the microcontroller. It usually takes a few seconds. That all may seem like a lot, but it is really not that complicated. You write the code, click a button to compile it, click another button to assemble it (with some IDE's such as the Proton IDE, you click a button and it takes care of both the compiling and assembling at once), and finally open the .hex file with another program (sometimes the IDE can do this step, too), click a button, and you're done! Here is what I would suggest you do to help you get started: Purchase the PICkit 1 8/14-Pin FLASH Starter Kit from Mouser.com. It is very inexpensive ($36) and can do everything you need to do to program PICMicro's. If you want to program in BASIC (which I highly suggest), download Proton IDE Lite (19MB, link mentioned earlier). The PICKit gives you an assembler (not used with Proton IDE because Proton IDE has its own), a programmer (interface board) and an application that works with the programmer, along with two microcontrollers to play with. MPLAB (an IDE for writing in C) is also included but you do not need it if you are programming in BASIC. If you have any questions, feel free to ask! ![]() |
Topher |
Posted: March 29, 2006 04:54 am
|
![]() Sr. Member ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 362 Member No.: 4,477 Joined: March 06, 2006 ![]() |
Just wanted to bump this up and suggest it be made a sticky. Im getting started with PICs and really wish I would have seen this earlier. It would have saved my and other peoples time.
|
kl27x |
Posted: April 04, 2006 04:58 pm
|
Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Spamminator Taskforce Posts: 4,269 Member No.: 4,223 Joined: February 06, 2006 ![]() |
This is very helpful info. One correction: I believe MPLAB is a free IDE for writing in assembler, not C. Also, Proton Lite BASIC Compiler is free, but is limited to 50 lines of code, and it only works for on four chips, but still seems like a nice way to get your feet wet. If anyone knows of other free compilers/trials, please add them to this post!
|
Geek |
Posted: April 05, 2006 09:06 am
|
||
![]() Moderator ![]() Group: Moderators Posts: 9,943 Member No.: 62 Joined: July 23, 2002 ![]() |
Good idea. There's good info here ![]() -------------------- -= Gregg =-
"Ratings are for transistors.....tubes have guidelines" (please do not PM me for advice. Non-forum business messages will be ignored) |
||
saveme |
Posted: April 16, 2006 12:51 pm
|
Newbie ![]() ![]() Group: Members+ Posts: 10 Member No.: 4,103 Joined: January 23, 2006 ![]() |
there is a C compiler called mikroC which works for all pics and is available as a demo version with the only limitation being that hex output is limited to 2k of program words.
all in all it is user friendly and a better choice for first timers who are writing small programs. The site also has an online ebook on the pic which is pretty good...wish i had known this earlier myself |
kl27x |
Posted: May 04, 2006 01:40 am
|
Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Spamminator Taskforce Posts: 4,269 Member No.: 4,223 Joined: February 06, 2006 ![]() |
Woohoo! There's a free MikroBASIC compiler, too! It works on nearly all chips, including the 16F84A and 877A.
http://www.mikroelektronika.co.yu/english/...basic/index.htm |
mravenca |
Posted: June 25, 2006 11:14 pm
|
![]() Sr. Member ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 359 Member No.: 1,899 Joined: January 25, 2005 ![]() |
It should not be such a big problem to build my own pic programmer.. Which I have come to after a short browsing and checking prices of the commercial ones. Here is a link at page with instructions how to build such a programmer, I haven't tried it yet and do not guarantee anything:)
http://www.bobblick.com/techref/projects/p...og/picprog.html ![]() -------------------- ---
Programmer is a machine that turns coffee and cigarettes into software |
mravenca |
Posted: June 25, 2006 11:20 pm
|
![]() Sr. Member ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 359 Member No.: 1,899 Joined: January 25, 2005 ![]() |
But I still miss a smart PIC tutorial. Need comparing of the possibilities of the current types. I would like one with flash memory, so I could make experiments without hazard
![]() -------------------- ---
Programmer is a machine that turns coffee and cigarettes into software |
HOTDROCKS |
Posted: June 25, 2006 11:26 pm
|
||
Forum Addict ![]() ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 614 Member No.: 1,268 Joined: September 14, 2004 ![]() |
On the microchip site they have this information all laid out in a table... As for the possibilities that is up to you and what you decide to do with the chip... You will find out that there are obviously more popular chips, and most people stick to them as newbies... If you want to just play around with one chip nothing is saying you can't take a 40 pin PIC and make it blink a single LED, and then build from there with lots of room for growth... |
||
mravenca |
Posted: June 25, 2006 11:33 pm
|
![]() Sr. Member ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 359 Member No.: 1,899 Joined: January 25, 2005 ![]() |
Yeah, I did not notice this>
http://www.microchip.com/stellent/idcplg?I..._PAGE&nodeId=74 So it surely indicates I should finally get some sleep:+)) Thank you -------------------- ---
Programmer is a machine that turns coffee and cigarettes into software |
kl27x |
Posted: June 26, 2006 02:05 pm
|
Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Spamminator Taskforce Posts: 4,269 Member No.: 4,223 Joined: February 06, 2006 ![]() |
The Bob Blick-designed Tait Classic Programmer than MRAVENCA linked is the schematic that I used. I am having fair success with it, with some problems. I use IC-PROG. A few tips:
In hardware menu, select "Tait Serial Programmer" in the programmer menu. Invert MCLR and VCC If you use XP, make sure to go to options > misc and enable windowsnt/2000 driver, and that you have the driver downloaded into the same folder as the exe. If you build it as an ICSP, like I did, make sure you keep clock and data lines separated, or they will interefere with each other. I experienced this, firsthand. If you use a ribbon cable, put the ground wire in between them. If you use ethernet cable, like I did, put your data and ground on a twisted pair and clock somewhere else. Don't make the ICSP cable overly long. If you are designing your own pcb, or you are using protoboard, I have discovered you can GREATLY simplify the trace layout by installing the buffer chip UPSIDE DOWN!!! If you get frequent errors, go to options > programming and enable "verify during programming." This will in the least save you time, and seems to improve performance for me. I have noticed that with longer programs, I see more errors. I am pretty sure that were a program long enough, my original setup would never have been able to program it, error-free, as the likely-hood of an error somewhere along the line would approach 100%. I would estimate this to be within 2k words, or so. This might be because I used ethernet cable for ICSP; dunno, really. I am not sure if tweaking has completely fixed this or not, because after doing the above steps, I finally got a longer program to install properly onto my pic, and I'm not gonna mess with it, again, until I figure out how to hook up my LCD. ![]() **Edit: Errors were due to a faulty laptop parallel port. Works perfectly with other computers. |
kl27x |
Posted: August 01, 2006 03:40 am
|
Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Spamminator Taskforce Posts: 4,269 Member No.: 4,223 Joined: February 06, 2006 ![]() |
I'm sure someone has probably posted this before. But I'm pretty excited to find this free programming software: PICPgm Programmer
It supports a few different chips. Plus it can be configured to work with any programmer, because you can configure the port pins any way you see fit. The only downside is the config bits aren't named, so you have to know your bits. |
fenugrec |
Posted: August 01, 2006 02:33 pm
|
Sr. Member ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 491 Member No.: 5,637 Joined: July 13, 2006 ![]() |
Rread and read and read the datasheet for your PIC... even if you're programming in basic or C.
|
draget |
Posted: August 12, 2006 08:43 am
|
Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Cleanup Taskforce Posts: 6,325 Member No.: 1,770 Joined: December 31, 2004 ![]() |
If you are an aussie might I recommend http://www.altronics.com.au/index.asp?area=item&id=K9505 . I bought mine at Jaycar, works nicely with my pentium 4s onboard serial.
|
rick |
Posted: January 03, 2007 11:32 pm
|
Newbie ![]() Group: Members+ Posts: 1 Member No.: 7,672 Joined: January 03, 2007 ![]() |
Is the PICkit 2 the place to start now ? I am a total newbie.
http://www.jameco.com/webapp/wcs/stores/se...roductId=697338 |
draget |
Posted: January 04, 2007 04:10 am
|
||
Forum Addict ++ ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Cleanup Taskforce Posts: 6,325 Member No.: 1,770 Joined: December 31, 2004 ![]() |
Sure |
||
CPW1992 |
Posted: February 09, 2007 03:38 am
|
Newbie ![]() ![]() Group: Members+ Posts: 18 Member No.: 3,850 Joined: December 16, 2005 ![]() |
Wow, I haven't been on here in about a year. I never realized this topic was stickied and had so many replies. I'm glad the information helped people.
I haven't done much microcontroller stuff in a while, but hopefully sometime soon I will get back into them. As for the PICKIT 2, I think that's what I meant to type in the first post, but for some reason I put 1. I'm pretty sure I have the 2 version, though. |
tanahguan |
Posted: August 22, 2007 06:15 am
|
Member ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 170 Member No.: 6,250 Joined: September 04, 2006 ![]() |
Microchip have a free version C compiler for their PIC18 series. Its called MPLAB C-18 compiler... search under Developement tools in their website
|
FunnyNYPD |
Posted: November 11, 2007 12:04 am
|
Jr. Member ![]() ![]() ![]() Group: Trusted Members Posts: 58 Member No.: 11,897 Joined: November 10, 2007 ![]() |
PICKit 2 used to be a very good programmer, now it supports debugging with MPLAB 7.62 and MPLAB 8.0.
For most of the PIC16s and PIC18s, PICKit2 function all-most identical as the ICD2 on programming and debugging. I own both ICD2 and PICkit2. Both are great products. Would recommend both. As a matter of fact, my colleages did a enhanced version of PICkit2 clone a while ago. Now it has been on production for three months. Our design fully implemented microchip recommended schematic and all Microchip posted hardware fixes. It also includes an enhanced feature: a dedicated power supply (just like the ICD2). Most of the components are SMD. The PICkit2 DIY board is on sale as less as US$5, and components kit are also available for people who would like to enjoy the fun. ![]() An anouncement has been posted on EDAboard forum (schematic, asembly drawing, test result, etc are all posted on my own web and the EDAboard forum): http://www.edaboard.com/ftopic273287.html Here is one picture: ![]() And This picture illustrates the size of our PICKit2 design with the newest ICD2 ![]() PICkit 2 bare PCB design: ![]() This post has been edited by FunnyNYPD on February 06, 2008 07:37 pm -------------------- Funny N.
|
FunnyNYPD |
Posted: February 06, 2008 07:41 pm
|
Jr. Member ![]() ![]() ![]() Group: Trusted Members Posts: 58 Member No.: 11,897 Joined: November 10, 2007 ![]() |
my experience with Microchip C18 is horrible. Lots of bugs and code size is huge compare with Hi-tech PICC.
-------------------- Funny N.
|
gramo |
Posted: November 22, 2008 03:05 am
|
||
![]() Forum Addict ![]() ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 625 Member No.: 8,536 Joined: March 06, 2007 ![]() |
I see your really trying to push the PK2 clone in here, my 2c - considering the legit PICKit 2 is $34.95 assembled, and also has the peace of mind its backed by Microchip (the guys that make PIC's)... Well it kinda doesn't matter what else you say from there. You said that you get a valuable lesson with the DIY kit.. Soldering seems to be the only gain with your clone, you might however have the likely chance of fault finding your programmer when it doesn't work ![]() All that aside, the legit PK2 casing is so much more suave then your bulky game cartridge contraption ![]() ![]() You can get it here from Microchip, and all the relevant info such as supported devices (pretty much all PIC's) and the such can be found on the site too -------------------- digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.
|
||
FunnyNYPD |
Posted: November 22, 2008 05:26 am
|
||
Jr. Member ![]() ![]() ![]() Group: Trusted Members Posts: 58 Member No.: 11,897 Joined: November 10, 2007 ![]() |
Really? Do they carry any warranty on PICKit 2? I am not aware of that. I knew ICD2 has life-time free exchange service, not sure Microchip PICkit 2 has the same. At least it wasn't publicly published as the ICD2 free exchange service. The Microchip PICkit2 schematic is a very good design. However Microchip's hardware design isn't so good. As far as I knew on the "reliability", That might not be so true because Microchip hardware design team seems having pushed some of the hardware component too close to its limit. Check out Microchip Forum, you will find the something like: Pump Your PICkit 2's VPP -------------------- Funny N.
|
||
FunnyNYPD |
Posted: November 22, 2008 05:30 am
|
||
Jr. Member ![]() ![]() ![]() Group: Trusted Members Posts: 58 Member No.: 11,897 Joined: November 10, 2007 ![]() |
as of the Microchip reliability,
here is another example on how good is the hardware design: Microchip Issues on Programmer-to-Go This post has been edited by FunnyNYPD on November 22, 2008 05:32 am -------------------- Funny N.
|
||
FunnyNYPD |
Posted: November 22, 2008 05:36 am
|
||
Jr. Member ![]() ![]() ![]() Group: Trusted Members Posts: 58 Member No.: 11,897 Joined: November 10, 2007 ![]() |
Here is another good example on " the reliability of a 'built by manufacture' backed with a warranty " On microchip PICkit 2, if you need 256K EEPROM for Programmer-to-go, you need do the following hardware hack, all by yourself:
Here is the family of BB0703, which includes the BB0703+256K: ![]() -------------------- Funny N.
|
||
gramo |
Posted: November 24, 2008 07:19 am
|
![]() Forum Addict ![]() ![]() ![]() ![]() ![]() ![]() Group: Trusted Members Posts: 625 Member No.: 8,536 Joined: March 06, 2007 ![]() |
I could have sworn that I replied to your posts earlier, but I can't see it here
![]() I'm actively against clones not only because I'm tired of getting emails from people who have issues with there home made jobs, but also because I've been bitten by poor quality boards in the past. Like I said, for $34.95 completely built and around $12 shipping (that was to Australia), the original PK2 wins hands down. I simply take my laptop with me when I want to program on site anyhow, yet to run into any issues with the USB supply voltage that you make sound like a major flaw.. Not only all that, but clones hinder the development of the real deal, comes hand in hand with piracy at the end of the day. -------------------- digital-diy.com - Hobby microcontroller projects and tutorials. Assembly, PICBasic and C examples.
|
![]() |
![]() ![]() ![]() |
:: support us ::