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 (https://www.semis.demon.co.uk/uJDM/uJDMmain.htm) looks pretty simple:
uJDMcct.GIF

3. Download some software for my laptop to program the chip with. PICPgm (https://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.
 

tpetar

Advanced Member level 5
Joined
Sep 27, 2010
Messages
6,427
Helped
1,713
Reputation
3,456
Reaction score
1,678
Trophy points
1,393
Location
Pancevo-Belgrade, Serbia
Activity points
37,372
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.
 

Sloth

Member level 2
Joined
Jun 7, 2011
Messages
48
Helped
17
Reputation
34
Reaction score
16
Trophy points
1,288
Location
Helsinki, Finland
Activity points
1,630
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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top