You are on page 1of 15

PIC16F84A

2002
1

.
Matrix
LEDs
Microcontroller

Microprocessor
.

Delay Time

.1

Output Data on Output Port

Procedure
..

Delay
Again

Movlw d'250' ;
Movwf 0x0f ;
Decfsz 0x0f ;
GoTO Again

250
0F

Shifting

11H

12H

13H

14H

15H

...

Bit 7

...

Bit 6

...

Bit 5

...

Bit 4

...

Bit 3

...

Bit 2

...

Bit 1

...

Bit 0

...

15H

...

Bit

11H

12H

13H

14H

:
Bit

11H

12H

13H

14H

15H

...

Bit 7

...

Bit 6

...

Bit 5

...

Bit 4

...

Bit 3

...

Bit 2

...

Bit 1

...

Bit 0

...

.2

.3

Scanning

Char

Representation

.4

Hexadecimal System
(

0
1
1
1
1
1
1

1
0
0
1
0
0
0

1
0
0
1
0
0
0

1
0
0
1
0
0
0

1
0
0
0
0
0
1

1
0
0
1
0
0
1

1
0
0
1
0
0
1

7
A

0
1
1
1
1
1
1

0
1
1
1
1
1
0

0
1
0
1
1
1
0

7 *5 )

0
1
1
0
0
1
0

1
0
0
1
0
0
1

1
0
0
1
0
0
1

1
0
0
1
0
0
1

0
1
0
0
1
1
0

Machine Language
(0

Binary System
10
)

16

1)

Decimal System
(

9)

.(FEDCBA

Hexadecimal System
:

11010101
D

5
5

..

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

:
:
. PIC16F84A

.1

.
.

. (74LS164)

.2

. NPN

.3

...

8 LEDs
.
Current Limiter
Matrix

.4
LEDS

.5

4FH
.

.1

11H
68

60
11H 12H 13H 14H 15H

..

..

..

4BH 4CH 4DH 4EH 4FH

..

.
.
.
.
.
.
.
.

Bit 7

Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
.

.2
.3

S
.(
(0

)
) 4FH

4FH

.4

.5

11H

LEDs
-:

LEDs

.1

11H
. ( Delay Time

LEDs

12H
. ( Delay Time

LEDs

.3

13H
. ( Delay Time

LEDs

)
.4

4FH
. ( Delay Time

.2

:
........
........
........
........
........
........
........

LEDs Matrix

4FH

.6

4FH

4EH
.(

4FH

4FH, 4EH
11H

.7

LEDs
.S
:
........
........
........
........
........
........
........

LEDs Matrix

4FH

.8

4DH

4EH

.(
4FH

4EH

) 4FH

S
.9

11H
LEDs
.

S
:

........
........
........
........
........
........
........

LEDs Matrix
9

4FH

.10

4CH

4DH
) 4FH

4DH

4EH

4EH

S
.(

4FH

.11

11H
.

LEDs
:
........
........
........
........
........
........
........

LEDs Matrix
4FH

.12

4CH

4DH

4DH

4EH
4BH

4EH
4CH

) 4FH

4FH

S
.13

11H
.

LEDs
:

........
........
........
........
........
........
........

LEDs Matrix
4FH
4CH

.14

4DH
4AH

4DH

4EH

4BH

4BH

4CH
. 4FH

10

4EH
0

4FH

.15

11H
.

LEDs
:

........
........
........
........
........
........
........

LEDs Matrix
.16

-:

.
S

11

:
MOHAMED

list p= pic16f84a
include p16f84a.inc
__config 0x3ff2
start

org 0x00
bsf 03,5
movlw 00h
movwf 05h
movwf 06h
bcf 03,5
goto aa

Oscillator

table addwf 02h,1


retlw
retlw
retlw
retlw
retlw
retlw

00h
7fh
20h
10h
20h
7fh

retlw
retlw
retlw
retlw
retlw
retlw

00h
3eh
41h
41h
41h
3eh

retlw
retlw
retlw
retlw
retlw
retlw

00h
7fh
08h
08h
08h
7fh

retlw
retlw
retlw
retlw
retlw
retlw

00h
0fh
18h
48h
18h
0fh

retlw 00h
retlw 7fh
retlw 20h
retlw 10h
retlw 20h
retlw 7fh
retlw
retlw
retlw
retlw
retlw
retlw

00h
7fh
49h
49h
41h
41h

retlw
retlw
retlw
retlw
retlw
retlw

00h
7fh
41h
41h
41h
3eh

retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw

00h
00h
00h
00h
00h
00h
00h
00h

;M

O
;O

H
;H

A
;A

;M

;E

D
;D
retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw

00h
00h
00h
00h
00h
00h
00h
00h

retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw

00h
00h
00h
00h
00h
00h
00h
00h

retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw

12

00h
00h
00h
00h
00h
00h
00h
00h

retlw
retlw
retlw
retlw
retlw
retlw
retlw
retlw

00h
00h
00h
00h
00h
00h
00h
00h

retlw
retlw
retlw
retlw
retlw

aa

bb

cc

dd

scan

00h
00h
00h
00h
0ffh

clrf 11h
clrf 11h
clrf 11h
clrf 11h
clrf 11h
clrf 11h
clrf 11 h
clrf 11h
clrf 11h
clrf 11h
clrf 11h
clrf 11h

retlw
retlw
retlw
retlw

00h
00h
00h
00h

retlw
retlw
retlw
retlw

clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h

retlw
retlw
retlw
retlw

clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h

movlw 00
movwf 0ch
movlw b'00111111'
movwf 0dh
call shift
incf 0ch,1
movf 0ch,0
call table
movwf 4fh
xorlw h'ff '
btfsc 03,2
goto aa
decfsz 0dh,1
goto dd
goto bb
call scan
goto cc
bsf 05,1
nop
bcf 05,1
bsf 05,2
bsf 05,0
nop
bcf 05,0
bcf 05,2

00h
00h
00h
00h

00h
00h
00h
00h

clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h
clrf 12h

retlw
retlw
retlw
retlw

clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h
clrf 13h

0CH
.
0DH
.Scanning
0FF
.

74LS164

movf 11h,0 movwf 06h


movf 12h,0 movwf 06h
movf 13h,0 movwf 06h
movf 14h,0 movwf 06h
movf 15h,0 movwf 06h
movf 16h,0 movwf 06h
movf 17h,0 movwf 06h
movf 18h,0 movwf 06h
movf 19h,0 movwf 06h
movf 1ah,0 movwf 06h
movf 1bh,0 movwf 06h
movf 1ch,0 movwf 06h
movf 1dh,0 movwf 06h
movf 1eh,0 movwf 06h
movf 1fh,0 movwf 06h
movf 20h,0 movwf 06h
movf 21h,0 movwf 06h
movf 22h,0 movwf 06h
movf 23h,0 movwf 06h
movf 24h,0 movwf 06h
movf 25h,0 movwf 06h
movf 26h,0 movwf 06h
movf 27h,0 movwf 06h
movf 28h,0 movwf 06h
movf 29h,0 movwf 06h
movf 2ah,0 movwf 06h
movf 2bh,0 movwf 06h
movf 2ch,0 movwf 06h
movf 2dh,0 movwf 06h
movf 2eh,0 movwf 06h

call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay
call delay

13

00h
00h
00h
00h

.1

.2
.3

movf 2fh,0
movf 30h,0
movf 31h,0
movf 32h,0
movf 33h,0
movf 34h,0
movf 35h,0
movf 36h,0
movf 37h,0
movf 38h,0
movf 39h,0
movf 3ah,0
movf 3bh,0
movf 3ch,0
movf 3dh,0
movf 3eh,0
movf 3fh,0
movf 40h,0
movf 41h,0
movf 42h,0
movf 43h,0
movf 44h,0
movf 45h,0
movf 46h,0
movf 47h,0
movf 48h,0
movf 49h,0
movf 4ah,0
movf 4bh,0
movf 4ch,0
movf 4dh,0
movf 4eh,0
movf 4fh,0
return

shift

movf 12h,0
movf 13h,0
movf 14h,0
movf 15h,0
movf 16h,0
movf 17h,0
movf 18h,0
movf 19h,0
movf 1ah,0
movf 1bh,0
movf 1ch,0
movf 1dh,0
movf 1eh,0
movf 1fh,0
movf 20h,0
movf 21h,0
movf 22h,0
movf 23h,0
movf 24h,0
movf 25h,0
movf 26h,0
movf 27h,0
movf 28h,0
movf 29h,0
movf 2ah,0
movf 2bh,0
movf 2ch,0
movf 2dh,0
movf 2eh,0
movf 2fh,0
movf 30h,0
movf 31h,0
movf 32h,0
movf 33h,0
movf 34h,0
movf 35h,0
movf 36h,0
movf 37h,0
movf 38h,0
movf 39h,0
movf 3ah,0
movf 3bh,0
movf 3ch,0
movf 3dh,0
movf 3eh,0

movwf 06h call delay


movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay
movwf 06h call delay

movwf 11h
movwf 12h
movwf 13h
movwf 14h
movwf 15h
movwf 16h
movwf 17h
movwf 18h
movwf 19h
movwf 1ah
movwf 1bh
movwf 1ch
movwf 1dh
movwf 1eh
movwf 1fh
movwf 20h
movwf 21h
movwf 22h
movwf 23h
movwf 24h
movwf 25h
movwf 26h
movwf 27h
movwf 28h
movwf 29h
movwf 2ah
movwf 2bh
movwf 2ch
movwf 2dh
movwf 2eh
movwf 2fh
movwf 30h
movwf 31h
movwf 32h
movwf 33h
movwf 34h
movwf 35h
movwf 36h
movwf 37h
movwf 38h
movwf 39h
movwf 3ah
movwf 3bh
movwf 3ch
movwf 3dh

14

movf 3fh,0
movf 40h,0
movf 41h,0
movf 42h,0
movf 43h,0
movf 44h,0
movf 45h,0
movf 46h,0
movf 47h,0
movf 48h,0
movf 49h,0
movf 4ah,0
movf 4bh,0
movf 4ch,0
movf 4dh,0
movf 4eh,0
movf 4fh,0
return
delay decfsz 0eh,1
goto delay
movlw 00h
movwf 06
bsf 05,0
nop
bcf 05,0
return

movwf 3eh
movwf 3fh
movwf 40h
movwf 41h
movwf 42h
movwf 43h
movwf 44h
movwf 45h
movwf 46h
movwf 47h
movwf 48h
movwf 49h
movwf 4ah
movwf 4bh
movwf 4ch
movwf 4dh
movwf 4eh

Delay Time

End

15