Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to program and use a PIC?

Status
Not open for further replies.

JohnJohn20

Advanced Member level 4
Joined
Feb 2, 2012
Messages
111
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,296
Activity points
2,377
Hi.

I don't know anything about PICs and I have spent hours on google trying to find an easy and cheap way to build and program a PIC chip for a small project.

I want to avoid a kitset if possible due to cost.

It looks like I will need to:
1. Buy a suitable PIC chip. The PIC16F628A looks OK because it is cheap and contains its own oscillator xtal.
2. Build a programmer to connect my laptop via the serial port to the chip. The uJDM Simple PIC Programmer (**broken link removed**) looks pretty simple:**broken link removed**
3. Download some software for my laptop to program the chip with. PICPgm (http://www.members.aon.at/electronics/pic/picpgm/) looks like it does the job.
winpicpgm_screen_1.png

4. Write a program using assembler (?) language. How difficult can this be?

Is that everything I need to program the chip?

5. Then I remove the chip from the programming board connected to my laptop and into my project board with LEDs for outputs and switches for inputs.
6. And then when I power up the IC, it will automatically execute the programming I have put into it.

Have I missed anything?

If it all looks OK then I will build it and (probably) come back with more questions.

Thanks.
 

Its ok all, but step 4 i didnt get impression that you realize that you need to have some programming knowledge.

You can make firmware in MikroC, MimkroBasic, MikroPascal, or any other compilers, and if you really advanced then you can use assembler.

4. Write a program using assembler (?) language. How difficult can this be?

Is that everything I need to program the chip?


---------- Post added at 02:13 ---------- Previous post was at 02:11 ----------

In programming software you should choose right uC which you programming.

You must manualy give command for start of programming.

---------- Post added at 02:15 ---------- Previous post was at 02:13 ----------

Use PICKIT2 programmer, it have USB, maybe some laptops dont have RS232 or there is problem with usb to RS232 conversion. My advice is to buy PICKIT2 or make PICKIT2 Clone.
 

Assembly-language is very complicated. Also making your own programmer is cheap, but it leaves you with more uncertainity. So here are the steps I recommend:

1. Choose a suitable pic
-PIC16F628A sounds ok

2. Buy Pickit
-version 2 or 3 recommended

3. download MPlab for programming
-C, C++ and assembly languages are supported
-A lot of hobby projects and libraries available
-very good support overall
-C is easy

4. Put a programming port on your project PCB.
-It's only a connector to specific pins described on the datasheet. Very easy.
-You don't need to take the microcontroller off every time you reprogram

Now you have "reset", "program" etc. buttons on MPlab, which make debugging easy. The program will normally execute when you power up chip. But now you also have for example "reset" if your program seems to freeze at button press or whatever. Starting programming PICs might be hard, but once you get your first button to control a led working, it should be easy to make something more complicated too.

---------- Post added at 08:59 ---------- Previous post was at 08:55 ----------

Actually. Maybe you shouldn't use PICs at all. Here's something very easy:

1. Buy Arduino

2. Download Arduino software

3. Read VERY EASY programming commands from Arduino site

Arduino is using an Atmel microcontroller and they've made microcontroller programming very easy. Arduino has tons and tons of hobby projects. I higly recommend you to look into this. This is also the cheapest alternative. No external programming device needed. Everythings open source. Arduino is about 20€ or so.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top