LED Chaser for PIC16F84A and PIC16F628A


This simple circuit functions as a 12 LED chaser.  A single illuminated LED ‘walks’ left and right in a repeating sequence, similar to the effect seen on KITT, the car in the Knight Rider TV series.

Fully commented source code and programmer ready HEX files are provided for the PIC 16F84A and 16F628A at the bottom of this page.

The circuit has been constructed on a PCB but can easily be built on strip-board, or a solderless breadboard.

LED Chaser program

This project has been put together for anyone starting with their first PIC and the source code is heavily commented with references to the PIC datasheets and the MPASM assembler user guide.

Although the PIC 16F84A is really obsolete and I wouldn’t normally do a project using it, this chip is used extensively throughout education and for many people this will still be their first step into the world of PICs.  I’ve also written a version for the PIC16F628A which is a pin compatible replacement for the 16F84A and I would recommend that if you intend to develop your interest in PIC microcontrollers you start using this device rather than the 16F84A.

Please note that the 16F84 and 16F628 without the ‘A’ suffixare not suitable for this project.  You must use the 16F84A or 16F628A parts.

Download schematic in PDF

Circuit Description

The heart of the LED chaser is the PIC microcontroller, IC1.  This can be either a PIC16F84A or PIC16F628A as software code is provided for either device. The program that runs on this chip controls the LEDs attached to the output port pins.  Resistors R1 thru R12 limit the current through LED1 – LED12 to a safe level that won’t damage the PICs I/O ports or LEDs. 

The value of the resistors has been selected to be safe rather provide maximum brightness.  If you decide to use high brightness blue, green or white 5mm LEDs you may need to change these from 270ohms to 100ohms.  For all other 5mm LEDs the 270ohm resistors will be fine.

Crystal Q1 and capacitors C1 and C2 connect to the oscillator circuit inside the PIC. This generate a stable 4Mhz clock which is used by the PIC to control the timing of the microcontroller core.  If you are using the PIC 16F628A you can omit these three components and use the PICs internal RC oscillator.  However, you will also need to make a change to the source code before programming the PIC so it knows to use it’s internal oscillator. (see here)

Capacitor C3 is used to decouple the 5 volt power supply rail.  If you are building the circuit on a breadboard or stripboard you should ensure it is located close to the PICs Vdd connection (pin 14 ).

The input voltage can be anywhere form 9 to 12 volts but the PIC requires a precisely controlled 5 volt supply.  This is provided by IC2, a 78M05 3-terminal  5 volt regulator.  Capacitor C4 decouples the input to the regulator.  Diode D1 protects the circuit from accidental reverse polarity of the input voltage.

Component List

You can buy all the parts needed to build this project from most component suppliers world wide. In the UK you can get everything from Rapid Online and I’ve included a parts list with their part numbers below.


READ  Make your own USB LCD controller using PIC18F2550

For more detail: LED Chaser for PIC16F84A and PIC16F628A

Current Project / Post can also be found using:

  • 12 channel led chaser with pic16f84a circuit
  • pic16f628a microcontroller led chaser
  • 12 channel led chaser pic16f84a
  • pic 16f 628a projects with hex code

Leave a Comment

= 3 + 4

Read previous post:
How to make a contact-less digital tachometer using IR-light reflection technique using PIC18F2550

Tachometer is a device that measures the rotational speed of any shaft or disc. The unit of the measurement is...

Scroll to top