Hi, this is a simple tutorial which will explain in very easy steps (step by step) how to program the pic16f84 micro controller.

Step1 : get a programmer, i suggest to build your own programmer because it's very cheap and you can learn something about the pic in the process, and also it's fun :) . You can find the detailed tutorial in the previews post. That is a jdm programmer and uses the serial port of the computer.

Step2 : get a software for you programmer. If you use a jdm programmer as I do, i suggest to use the ponyprog2000 software, its great and does exactly what you what it to do :) : it writes your program to the pic16f84 microcontroller. In the image bellow you can see the configuration panel for the jdm programmer (this works with the programmer described on the previews post).

programmer settings

programmer settings

Don't forget to select the correct serial port if you have more than one. If you click Probe and there is an error, it's no problem, just load an hex file and write it to the pic, and it should work. If the program is transferred with success a success message will appear, else a fail message will appear

Step3: Write a simple program to test the pic, I suggest you load a value on a port, or something really easy, with which you can test if the pic is working.

Here is a very simple test program which will load a bit pattern to portb:


processor 16f84A
include  <p16f84a.inc>
__config _CP_OFF &_XT_OSC &_WDT_OFF &_PWRTE_ON
list    p=16F84A
radix    hex
PortB    equ    0x06        ; we define the port b address
org    0x000
start
movlw    0x00        ; we load the 0 value on the working register
movwf    0x86       ; move the value from w to the address 0x86, this sets all the bits in port b to be outputs
movlw   0x5b        ;load some values on the W
movwf   PortB        ;move the values from W to portB, this is the moment when the leds are lighting
repeat   goto    repeat    ; repeat this forever
end

Step4: Get a pic simulator, i personally use the demo from oshonsoft (http://www.oshonsoft.com/pic.html) works really nice... if you like it you can buy it. Now if the program works as it should work, you can 'burn' it to the pic.

Step5: Insert the pic into the programmer and burn the program to the pic. After this remove the pic from the programmer and insert it into the test circuit, power up the circuit and admire the results of your work.

Also usually when i insert and remove the pic from the programmer this is not connected to the serial port, i do this to avoid frying the microcontroller.

If you are a begginer like me, you will have to test a lot of things until you can start doing really amaizing stuff, so i sugest you build some kind of test board for your pic, i built one, bellow it's a picture with the pic16f86 development board. It contains the very basic stuff you need to have to make it work. My developnemt board is also under development, :) but i'll add a post as soon as possible. Now both pic's ports are taken separatly each pin is protected with a 470ohms resistor, it has an 4mhz quartz oscilatro and a voltage stabilisator and filter. I also added a 12 pin socket (on which i put a 4 digit clock display for now)

pic16f84 development board

pic16f84 development board

development board

development board

empty development board

empty development board

I really hope that this very simple tutorial will help you to create your very first pic program or application. If you have any questions don't hesitate to comment on this post and leave me qustions.

Related posts:

  1. Asm programming vs C programming
  2. pic 16f84 jdm programmer
  3. Stepper motor controller
  4. Stepper motor inteligent driver and controller
  5. Mood light