For my very first project submission I'd like to present a relatively simple PIC based LED sequencer project. By "relatively simple" I mean each LED is directly driven from an I/O pin, and while this method generally uses more pins when compared to multiplexing to drive the same number of LEDs, it does make the PIC program much simpler.
Prerequisites
While you don't need to be a micro controller expert to build this project and create nifty LED FX (effects), you will need the (free) Microchip MPLAB IDE (integrated development environment) installed on a PC and a programmer such as the PICKIT2 to "burn" the program which contains your LED 'FX' sequences into the PIC device. You also need the basic skills and tools necessary to build the project on a solderless breadboard or a prototype board.
Hardware
While the project requires very few parts, you need to decide how you want to build it. I used an inexpensive phenolic prototype board available from Radio Shack (sku 276-149) with a plastic coated paper silkscreen glued onto the top, but you might decide to build the circuit on a solderless breadboard or perhaps etch your own printed circuit board.
Software
The program is designed to continuously display LED sequences contained in one of eight FX (effects) tables. Each table can contain up to 255 sequences or steps and each step contains two parts, (1) the LED <pattern>, and (2) the <duration> for that pattern. The <pattern> part of each step is simply eight bits which match the position of the eight LEDs on the project board. A '1' bit will turn an LED on while a '0' bit will turn an LED off. The <duration> part of each step must contain a value from 1 to 255 which corresponds to the time the pattern will be displayed in 10-ms increments (1..255 duration = 10..2550 msecs) before going on to the next step. When the program has finished displaying the last step in an FX table, it wraps around to start again at the first step in that table. When you press the push button switch, the program will move on to displaying the next FX table. Here's what one of the program FX tables looks like (for a Knight Rider type effect);
Using MPLAB, the user can edit or modify any line in an FX table or insert and delete lines in an FX table and the program will automatically keep track of the number of steps in each table.
Summary
Short of teaching someone how to use MPLAB, which is beyond the scope of this article, feel free to ask questions if, as I suspect, I've left out some important piece of information.
Cheerful regards, Mike
Prerequisites
While you don't need to be a micro controller expert to build this project and create nifty LED FX (effects), you will need the (free) Microchip MPLAB IDE (integrated development environment) installed on a PC and a programmer such as the PICKIT2 to "burn" the program which contains your LED 'FX' sequences into the PIC device. You also need the basic skills and tools necessary to build the project on a solderless breadboard or a prototype board.
Hardware
While the project requires very few parts, you need to decide how you want to build it. I used an inexpensive phenolic prototype board available from Radio Shack (sku 276-149) with a plastic coated paper silkscreen glued onto the top, but you might decide to build the circuit on a solderless breadboard or perhaps etch your own printed circuit board.
Rich (BB code):
Parts List
1 ea. - C1, 0.1uf monolithic ceramic capacitor
8 ea. - D1-D8, generic discrete LED
8 ea. - R1-R8, 470 ohm, 1/8th watt carbon film resistor
1 ea. - R9, 10 kohm, 1/8th watt carbon film resistor
1 ea. - SW1, generic PCB momentary contact switch
1 ea. - U1, PIC16F628A micro controller
1 ea. - prototype board or solderless breadboard
1 ea. - regulated 5 volt D.C. power source
The program is designed to continuously display LED sequences contained in one of eight FX (effects) tables. Each table can contain up to 255 sequences or steps and each step contains two parts, (1) the LED <pattern>, and (2) the <duration> for that pattern. The <pattern> part of each step is simply eight bits which match the position of the eight LEDs on the project board. A '1' bit will turn an LED on while a '0' bit will turn an LED off. The <duration> part of each step must contain a value from 1 to 255 which corresponds to the time the pattern will be displayed in 10-ms increments (1..255 duration = 10..2550 msecs) before going on to the next step. When the program has finished displaying the last step in an FX table, it wraps around to start again at the first step in that table. When you press the push button switch, the program will move on to displaying the next FX table. Here's what one of the program FX tables looks like (for a Knight Rider type effect);
Rich (BB code):
fx2
dt (fx3-fx2)/2 ; <steps> |B0
dt b'00000001',8 ; <pattern>, <duration> |B0
dt b'00000010',8 ; |B0
dt b'00000100',8 ; |B0
dt b'00001000',8 ; |B0
dt b'00010000',8 ; |B0
dt b'00100000',8 ; |B0
dt b'01000000',8 ; |B0
dt b'10000000',8 ; |B0
dt b'01000000',8 ; |B0
dt b'00100000',8 ; |B0
dt b'00010000',8 ; |B0
dt b'00001000',8 ; |B0
dt b'00000100',8 ; |B0
dt b'00000010',8 ; |B0
fx3
Summary
Short of teaching someone how to use MPLAB, which is beyond the scope of this article, feel free to ask questions if, as I suspect, I've left out some important piece of information.
Cheerful regards, Mike
Attachments
-
266.1 KB Views: 885
-
275.5 KB Views: 189
-
13.2 KB Views: 161
-
24.9 KB Views: 157
-
32.5 KB Views: 403