Instructables
Picture of 8x8 LED matrix
Picture 003.jpg
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
 
Remove these adsRemove these ads by Signing Up

Step 1: Materials

Picture of 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 3: The code.

The code is written in assembly.

This code is based on the code from http://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.
ajperez5 months ago

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

ERROR..jpg
nikkaniks1 year ago
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
nikkaniks1 year ago
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...
nikkaniks1 year ago
hello this is my screen shot of my errors during my program in MPLAB. http://img94.imageshack.us/img94/3340/8x8.png
hemmikarl (author)  nikkaniks1 year ago
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 ;
;------------------------------------------------------------------;
nikkaniks1 year ago
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.
nikkaniks1 year ago
thanks sir, will try what you tell us to do. :) have a good day!
nikkaniks1 year ago
that is my problem too. can you help us sir? please do reply. THANKS!
hemmikarl (author)  nikkaniks1 year ago
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?
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
hemmikarl (author)  lila_cassidy1 year ago
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?
How can I gate IC programming soft wear
hemmikarl (author)  shibbir ahammad1 year ago
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
nadsa2 years ago
I'm using pic16f877a... Can you translate this to it???Pls... I'm a beginner to pic..

Thanks
how to get a full schematic of it?can anyone save me
danilo-dude3 years ago
OK, so let's say I built this. Because I'm a beginner and i don't know almost anything about circuits and stuff, how should I program the microcontroler to show some letters? I make the letters, save them but how to upload them to the microcontroler? Thanks in advance!
kalasas183 years ago

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. :)
hatdh kalasas183 years ago
help me complain
goto $+1
goto $+1
goto $+1
what does $ mean?
hemmikarl (author)  kalasas183 years ago
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
I have a question from this source code:

;-----------------------------------------------------
output:

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
bcf PORTB,4


movfw Line2
movwf PORTC
bsf PORTB,5
movfw Brightness
call Delay ; call the delay
bcf PORTB,5 ; turn off layer 1
;-------------------------------------------

this code show indisplays line2 to spend line1. I want to display the line1 and line2 in one time. How to change the code?
jeffr183 years ago
How difficult would it be to control this with an arduino? can anyone push me in the right direction?
kalasas183 years ago
i need a simple code from picture (A or F or K letter). please write something the code. :/
Hey so the code is just a simple 1 and 0? So how can I program this pic so i can just put power to one output. Just to make a led blink.
hemmikarl (author)  Pyrotechnic-Robot3 years ago
no the code is not just a simple 1 and 0. the code translates the 1 and 0 into what it should send to the outputs.
this is coded with assembler code

http://www.mstracey.btinternet.co.uk/pictutorial/picmain.htm

this is a good learning tool (althoug i'd like to point out that i don't know how to write a program from scratch i am capable of modifying programs alredy written)

and a good way to start is to actually understand what each command does (althoug he post it in hex format and i use text format for the commands)

movlw is moving some value into the register W for example
movlw b'10000000'
now the binary number 10000000 is in the w register
to move something from the W register into another name for example name_1

movlw b'10000000'
movwf name_1

here is a code that i put together for you to make a LED blink (uses PORTC 0 as output)


;Code starts
;-----------------------------------------------------------------------------

#include
__config (_INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_OFF & _MCLRE_OFF & _CP_OFF & _BOR_OFF & _IESO_OFF & _FCMEN_OFF)


; Delay = 1 seconds
; Clock frequency = 4 MHz

; Actual delay = 1 seconds = 1000000 cycles
; Error = 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'1'
movwf PORTC
call Delay
movlw b'0'
movwf PORTC
call Delay
goto loop
start:
bsf STATUS,RP0 ; select register page 1
movlw 0 ; put 0 into W
movwf TRISC ; set portC all output

bsf STATUS,RP1 ; select Page 2,
bcf STATUS,RP0 ; by setting RP1 in Status register and clearing RP0

clrf ANSEL ; select Digital I/O on port C
clrf ANSELH ; " "

bcf STATUS,RP1 ; back to Register Page 0
goto loop

end

;-----------------------------------------------------------
;Code ends
leftright4 years ago
what if we're not allowed to used a microcontroller? thanks!
You could probably hook the power up individually and switch them yourself but the microcontroller would really be what you'd need to actually be able to make patterns automatically (without your interaction).
actually, it is not displayed automatically. we must use push buttons (or any) to display a certain pattern. any tips? thanks!
I suppose you could use a 555 timer and counter to create a scanning row, then another counter triggered at the bottom of the first one. The, All you need id to have switches at the output of the counters. (9 for each pattern) Then, 64 AND gates for each pattern. It would be very complicated. You could just wire up many leds in parallel. It just wouldn't have multiple patters.
purpulhaze5 years ago
I have a few 8x8 bicolor dot matrix LEDs I bought off of ebay some time ago that I would like to use but I'm a bit confused on the pin out. I believe they are red/green 8x8 dot matrix leds. There are 12 pins at the top and 12 at the bottom. Which gives me a total of 24. I understand I will only connect a total of 16 pins for rows and columns. So what ones do i use? I've looked over the data sheet time and time again and I'm still confused.

http://www.sure-electronics.net/DC,IC%20chips/LE-MM103_4_b.jpg
hemmikarl (author)  purpulhaze5 years ago
pins 3 6 9 12 13 16 19 are common anode for both green and red. pins 24 21 18 15 1 4 7 10 are the green cathodes pins 23 20 17 14 2 5 8 11 are red cathodes at least if this is the right schematic of the part
thekanester5 years ago
Nice work!
hemmikarl (author)  thekanester5 years ago
thanks
uguy5 years ago
I like the project, but a full clearer schematic would make it much better and easier to duplicate.
hemmikarl (author)  uguy5 years ago
what is missing in this schematic? (exept for the 42 LED's)