Getting started with your PIC programmer:
An example


Introduction

The PIC programmer will be explained with a small example using a PIC16F84 µController.
The example "LEDSRUN" is a small running light using 4 leds connected to the PIC. 

The example program LEDSRUN is written in the Microchip assembly language and compiled with MPASM / MPLAB .
If you are interested in the source code please download it here.
 

The example circuit "LEDSRUN"

To use this program connect four LEDs from each of RB0-RB3 of the PIC16F84  to ground  via four 470 ohm resistors
and connect an RC oscillator as in the schematic below:

With the program LEDSRUN, the LEDs wil llight up sequentially as a running light.
 

Programming the PIC 16F84

  1. First set up your PIC programmer and make sure that the GREEN LED is on.

  2. Insert a PIC16F84 in the 18-pin socket and start PONYPROG.

  3. Download the HEX file in zipfile LEDSRUN.zip (1kByte) and open it using "File ® Open Device File":


     
  4. Set the so called  fuses using "Edit ® Modify Security Bits" as below:
    (If you set them in your assembly code, you can check here if they are OK)



In this example, check the WDTE, leave the rest unchecked.
Now the watchdog timer is disabled so the PIC does not care if a loop takes very long.
If you don't disable the watchdog timer, the LED's will show "hickups" because the WDT kicks in.

 

 

      Security bits explanation:

  1. Now "burn" the program into the PIC using: "Command ® Write All" as below:
    (With write all the security bits and the Program (FLASH) are written at once)


    The next message appears: (yes is the answer)


    A progress meter appears showing write and veryfiing progress:

    And finally the last message appears:

     
  2. Now the PIC is programmed and ready to be used in the application.
    Insert the PIC16F84 into LEDSRUN circuit, apply 5 Volts to the circuit and the LEDS will light up sequentially.

BACK TO MAIN PAGE