Light Sequencer Using Assembly & Microchip PIC16F690

About: A student currently in Grade 12 in Toronto. Male, from China. Loves computer science. Goal: to introduce Chinese culture through technologies. Thank you for your support! Reach me at

The purpose of this project is to build a light sequencer to test a player’s reaction speed. The user interface of this light sequencer consists of 8 LEDs and a button. On the technical side, we are going to send code written in assembly language with MPLAB X IDE, into a microcontroller to control LEDs and read input from the button. Once the program runs, the LEDs display a sweep sequence and wait for the player to initiate the game by pressing the button. After button pressed, the LEDs go off for a random amount of time and immediately ramps up (as in lighting up from the first one to the last one and repeating this routine). All the player has to do is to press the button again once he sees the LEDs starting to light up in sequence. The LEDs then display a set of cheerful patterns only if the player reacts before the fourth LED lights up. At last, the program restarts the game by going into sweep mode. Yes, I know you can’t wait to make this addictive game, so let’s build it now.

Step 1: Materials

“Give me six hours to chop down a tree and I will spend the first four sharpening the axe.” (Abraham Lincoln)

Being prepared and in possession of necessary materials is crucial to succeed in this project. Get your hand on these parts and software. If you can’t, so sad you’d have to rethink a lot of the logic, because low-level programming is very specific to the hardware you use, or “machine specific”. For example, creating a light sequencer with PIC16F690 by Microchip, which we are using, will have a difference code and a different hardware schematic than using MCS-51 by Intel, because they have different internal structures, I/O pins and even require different assembly syntaxes.

Note: We recommend you prepare a chip extractor which makes it easier to pull out your microcontroller from PICkit and breadboard. Otherwise you might accidentally break some critical pins on the microcontroller and start complaining about buying a new one with shipping cost and having to wait for a few weeks to resume your project.

Step 2: Hardware

First, we are going to understand the hardware and connect everything in the right way.

  • Technical: The microcontroller PIC16F690 has 20 pins: Vss (power), Vdd (ground), 6 pins for Port A, 4 for Port B and 8 for Port C. There are three ports, and each can be set to input or output. In this project, we are going to use Port C as output, since 8 pins correspond to 8 LEDs, and Port B as input. Note that the LEDs we use can endure a maximum current of 20mA, and if we are using a 5V power supply in the circuit we will need to add a 150Ω resistor in series with each LED. We will only exploit one pin of Port B since we have only one button and let’s use pin RB4 for it. You will need to refer to the PIC16F690 datasheet. Refer to Appendix A for pictorial of hardware setup.
  • Instructions

1. Connect positive of each LED to a pin of Port C of the microcontroller in series with a 150Ω resistor and negative to GND.

2. Connect one end of button to RB4 bit of Port B and the other end to GND.

3. Connect Vss of microcontroller to GND and Vdd to 5V.

That’s it for the hardware. Simple and Neat. Check your hardware before moving on to make sure that you have everything connected in the right place and you won’t burn out anything.

Step 3: Link to Report

That will be an introduction to this instructable. To view the entire instructable, proceed to this link.



    • Tape Contest

      Tape Contest
    • Epilog X Contest

      Epilog X Contest
    • Trash to Treasure

      Trash to Treasure