Introduction: 8x8 LED Matrix
This instructable will show you how to make a 8x8 LED matrix in witch you can control evry single LED and create your own patterns as long as they only need 64 pixels to show them in one color.
Update 25.09.10
I've added a pattern generator to create patterns but not all of it's features are complete
Attachments
Step 1: Materials
Materials you need:
-8x8LED matris (can make one but i bought mine)
-16x120Ohm resistors
-8xNPN transistors (I used C547B)
-1xPIC16f690
-prototype board (or you can make pcb for this)
-wire
-5V power supply (you can use a voltige regulator but I just power mine from a usb port)
Tools:
-PIC programmers (all the pic programmers from microchip exept for pickit1 will work)
-Software- MPLAB (free software from microchip)
-Soldering iron
-A vacum pump for removing solder is good to have
-wire cutters
Skills you need:
-soldering skill (being capable of making good solder connections within 5-10 sec.)
-Logic thinking to some level
If this is your first experiense using microcontrollers I recommend that you start with a more simple project.
Step 2: The Circuit
This is the circuit schematic.
NOTE that you will need to look at the datasheet of your led matrix (if you bought one) or know how to connect the matrix you made
Step 3: The Code.
The code is written in assembly.
This code is based on the code from https://www.instructables.com/id/3x3x3-LED-Cube/ but you can not use the genorator that he supplys sense it only has 27 diodes and is has "layer1 layer2 layer3" insted of "line1...." and also has only got 3x8 bit numbers while have 8x8 bit numbers
NOTE the letters in this code may display in reverse sense I accidentally reversed the ground in my display.
Attachments
Step 4: Editing Patterns Displayed.
You can add and remove patterns as you like in this matrix.
to add a pattern simply generate the pattern with the generator that is included in this step....
It is a .rar file so use winrar to unzip it.
And yet agin I want to thank portreathbeach for having the source code of the genorator in his document about the www.instructables.com/id/3x3x3-LED-Cube/
to make a moving design you can few steps to the subroutine and it will be like this.
;-----------------------------------------------------------------------------------------------;
; Test sub routine ;
;-----------------------------------------------------------------------------------------------;
Test:
movlw b'01111100'
movwf Line1
movlw b'11000110'
movwf Line2
movlw b'00000011'
movwf Line3
movlw b'00000011'
movwf Line4
movlw b'00000011'
movwf Line5
movlw b'00000011'
movwf Line6
movlw b'11000110'
movwf Line7
movlw b'01111100'
movwf Line8
movlw b'11111111'
movwf Layer4
call Output
movlw b'01111100'
movwf Line1
movlw b'11000110'
movwf Line2
movlw b'00000011'
movwf Line3
movlw b'00000011'
movwf Line4
movlw b'00000011'
movwf Line5
movlw b'00000011'
movwf Line6
movlw b'11000110'
movwf Line7
movlw b'01111100'
movwf Line8
movlw b'11111111'
movwf Layer4
call Output
return
you will also have to add a function at the bottom of the asm file
The bottom few lines will be somthing like this.(the call function is to call the subroutines you can call them in any order you want to)
Loop:
call Someroutine
call Test
call Test
goto Loop
end
Attachments
Step 5: The Finished Product
Here are the results of the matrix... you can control evry single LED on this matrix through the code

Participated in the
Get the LED Out! Contest
35 Comments
5 years ago
Hi,
Can anyone send me assembly code for 8X * led Matrix with ardiuno.Please mail me if it's possible
7 years ago
Hi,
Can anyone share a code for 8x10 led matrix with Arduino.. pls mail me if possible
abhijit2683@gmail.com ..
thanks in advance
9 years ago on Introduction
im done on the code that you've been discussed on this website...but a little confuse on how to convert the code.asm to hex file...to burn it to the pic16f690
10 years ago on Introduction
Good evening, Thanks , you're given code and circuit worked. you're code and circuit help me a lot. But I have a question on how can I simply move the letters from left to right or vice versa, or just scrolling text.? do you have any idea on how to do it? thanks mr. hemmikarl for the help. I hope you can help me with my little problem to improve my circuit project. thanks again. this is my accomplished circuit based on your tutorial,
http://img820.imageshack.us/img820/7044/newnl.jpg
10 years ago on Introduction
my problem about the mplab was resolved. i reinstall my MPLAB and it works... i already built the circuit...but i cant see any pattern... it seems like a random lighting of leds...
10 years ago on Introduction
hello this is my screen shot of my errors during my program in MPLAB. http://img94.imageshack.us/img94/3340/8x8.png
Reply 10 years ago on Introduction
do lines 43 to 53 look like this?
Time ; time for each pattern to stay
Temp ; temp register
endc
goto Start ; jump to Start
;------------------------------------------------------------------;
; Subroutines are here at the top ;
;------------------------------------------------------------------;
10 years ago on Introduction
your project helps a lot but im new in circuit building the schematic above is kinda confusing.. can you please provide a more specific pin connections. thank you very much hoping for your response thank you again and god bless.
10 years ago on Introduction
thanks sir, will try what you tell us to do. :) have a good day!
10 years ago on Introduction
that is my problem too. can you help us sir? please do reply. THANKS!
Reply 10 years ago on Introduction
make sure the file name is correct
you can go directly to the file online (it's just a text file) and copy all of it
in MPLAB create a new file, paste the code into it and save as "something.asm"
I usually just use Quickbuild with asm files
I tried downloading it and it works fine with me
could you please send a screenshot of the errors you are having?
10 years ago on Introduction
Hi, im new with this microcontroller programming. I already downloaded MPLAB. The problem is that when i put the code(LED_matrix.asm) there's a lot of error.
Please help me .
sample errors
Executable code and data must be defined in an appropriate section
Operand contains unresolvable labels or is too complex
Reply 10 years ago on Introduction
make sure the file name is correct
you can go directly to the file online (it's just a text file) and copy all of it
in MPLAB create a new file, paste the code into it and save as "something.asm"
I usually just use Quickbuild with asm files
I tried downloading it and it works fine with me
could you please send a screenshot of the errors you are having?
10 years ago on Introduction
How can I gate IC programming soft wear
Reply 10 years ago on Introduction
The sofrware is free BUT you need a pic programmer for example I used PicKit2 in this project, Now a newer programmer is awailable it's called PicKit 3
the software is called MPLAB and you can get it from Microchip.com
you can get a pickit at microchipdirect.com, ebay or mabye even at a local electronics store
11 years ago on Introduction
I'm using pic16f877a... Can you translate this to it???Pls... I'm a beginner to pic..
Thanks
11 years ago on Introduction
how to get a full schematic of it?can anyone save me
12 years ago on Introduction
I have a simple ASM program with a matrix display light just columns. An example:
;-----------------------
LIST P=16F876
#include <p16F876.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
ORG 0x2100
DE 0x00
ORG 0
cblock 0x20
d1
d2
d3
endc
goto start
Delay
;999990 cycles
movlw 0x07
movwf d1
movlw 0x2F
movwf d2
movlw 0x03
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;6 cycles
goto $+1
goto $+1
goto $+1
;4 cycles (including call)
return
loop:
movlw b'00000111'
movwf PORTA
movlw b'11110010'
movwf PORTB
movlw b'11111111'
movwf PORTC
call Delay
call Delay
call Delay
goto loop
start:
bsf STATUS,RP0 ; select register page 1
movlw 0 ; put 0 into W
movwf TRISC ; set portC all output
clrf TRISA
clrf TRISB
bsf STATUS,RP1 ; select Page 2,
bcf STATUS,RP0 ; by setting RP1 in Status register and clearing RP0
clrf PORTC ; select Digital I/O on port C
bcf STATUS,RP1 ; back to Register Page 0
goto loop
end
;-----------------------
This program code is OK. But I want the program to which I could display the words fleeing across the screen. Started, I tried to ignite a pair of columns on different sites but with the burning LEDs. But received some strange flashing, do not light longer ... Anybody know what's wrong ...
Programme code:
;-----------------------
LIST P=16F876
#include <p16F876.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
ORG 0x2100
DE 0x00
ORG 0
cblock 0x20
Delay1 ; delay loop 1
Delay2 ; delay loop 2
Delay3 ; delay loop 3
TimeDelay ; time delay x 0.001 s
EndCount ; used to tell PIC the end of the table is reached
Counter ; used as table counter
Line1 ; Line 1
Line2 ; Line 2
Line3 ; Line 3
Line4 ; Line 4
Line5 ; Line 5
sad
Line6 ; Line 6
Line7 ; Line 7
Line8 ; Line 8
Layer4 ; brightness, and time
Brightness ; LED brightness
Time ; time for each pattern to stay
Temp ; temp register
d1
d2
d3
endc
goto start
Delay
;999990 cycles
movlw 0x17
movwf d1
movlw 0x2F
movwf d2
movlw 0x03
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;6 cycles
goto $+1
goto $+1
goto $+1
;4 cycles (including call)
return
loop:
movlw b'00000001'
movwf Line1
movlw b'11110010'
movwf Line2
call output
call Delay
movlw b'11100000'
movwf Line1
movlw b'10101010'
movwf Line2
call output
call Delay
goto loop
start:
bsf STATUS,RP0 ; select register page 1
movlw 0 ; put 0 into W
movwf TRISC ; set portC all output
clrf TRISA
clrf TRISB
bsf STATUS,RP1 ; select Page 2,
bcf STATUS,RP0 ; by setting RP1 in Status register and clearing RP0
clrf PORTC ; select Digital I/O on port C
bcf STATUS,RP1 ; back to Register Page 0
goto loop
output:
movfw Layer4
andlw b'00000001'
movwf Time
incf Time,1
bcf STATUS,C
rlf Time,1
bcf STATUS,C
rlf Time,1
bcf STATUS,C
rlf Time,1
bcf STATUS,C
rlf Time,1
bcf STATUS,C
rlf Time,1
clrf PORTB ; clear port B
movfw Line1 ; move layer1 to W
movwf PORTC ; put W onto PortC
bsf PORTB,4 ; turn on layer 1 buy outputing bit 5 of PortB
movfw Brightness ; put brightness into W
call Delayy ; call the delay
bcf PORTB,4 ; turn off layer 1
movfw Brightness ; put Brightness into W
sublw 4 ; sub W from 4
btfss STATUS,Z ; skip if the zero flag is set
call Delayy ; call the delay
decfsz Time
clrf PORTB ; clear port B
movfw Line2 ; move Line2 to W
movwf PORTC ; put W onto PortC
bsf PORTB,5 ; turn on layer 2 buy outputing bit 6 of PortB
movfw Brightness ; put brightness into W
call Delayy ; call the delay
bcf PORTB,5 ; turn off layer 2
movfw Brightness ; put Brightness into W
sublw 4 ; sub W from 4
btfss STATUS,Z ; skip if the zero flag is set
call Delayy ; call the delay
decfsz Time
decfsz Time ; decrement the Time regiester
return
Delayy:
movwf Delay3 ; put W into Delay 3
Loop1:
; After Delay2 decreses to 0, it is reset to..
movlw 0x1 ; put 1 into W
movwf Delay2 ; put W into Delay2
Loop2:
; After Delay1 decreses to 0, it is reset to E9h
movlw 0x1D ; put 80 into W
movwf Delay1 ; put W into Delay1
Loop3:
decfsz Delay1 ; decrement Delay1
goto Loop3 ; jump back to Loop3
decfsz Delay2 ; decrement Delay2
goto Loop2 ; jump back to Loop2
decfsz Delay3 ; decrement Delay3
goto Loop1 ; jump back to Loop1
return
end
;----------------------------------------------------------
Thanks for help. :)
Reply 11 years ago on Introduction
help me complain
goto $+1
goto $+1
goto $+1
what does $ mean?
Reply 12 years ago on Introduction
A part of your problem might be the
Delayy:
that your subroutine is called but you call Delay on some parts of your code
The other part of your problem might be that you clear PORTB in the call of outputs
The code does not put PORTC all to 0 before it starts outputting so that might be a part of your problem
If it´s neither of those then I'm not sure what's wrong