You are on page 1of 5

LED moving message diaply using

PIC16f628 CD4017 and 74LS595


by Ivan
SECOND MMD PROJECT
LED moving message diaply using PIC16f628 CD4017 and 74LS595
Introduction of MMD Project-2:The PIC microcontroller PIC16f628 is used the main processor in the MMD. The difference from the
previous moving message diaply and this is method for scaning the rows. In previous MMD a decoder
74LS138 was used to scan the rows. But in this project, i have used CD4017 for row scanning instead of
use of any decoder.
Components of the LED moving message display:LED matrix = 88 LED matrix 8 Nos,
MCU = PIC16f628
Shift registers = 74LS595 8Nos
crystal = 4MHz with 22 pF capacitors.
and other basic components like reset switches and regulated power suplly of 5V which have enough
current baring for this project like 1Amp max.
The circuit diagram of the 8 x 8 x 8 LED matrix moving message display using PIC microcontroller is as
under:-

Code of the Moving message diaply is written in proton basic compiler and is as under:Device=16F628A
XTAL=4
ALL_DIGITAL=true
Output PORTB
Symbol SER = PORTB.0 Serial data Pin

Symbol SRCLK = PORTB.1 Serial data Clock Pin


Symbol SRClr = PORTB.2 Serial data Clear
Symbol Latch = PORTB.3 Columns, Latch
Symbol RowClk = PORTB.4 Row clock, to select new row
Symbol Rowrst = PORTB.5 Row reset, selects row 0
High SRClr Turn off the serial register clear
Dim serial_buffer[128] As Byte
STR serial_buffer = www.PICinf.blogspot.com , 0
Dim i As Byte
Dim n As Byte
Dim b As Byte
Dim c As Byte
dim m as byte
dim l as byte
dim ch_index as byte
dim start_ch_idx as byte
dim end_ch_idx as byte
for b =0 to 128
if serial_buffer[b]>0 then serial_buffer[b] =serial_buffer[b]-32
next b
setup for positive pulses:
lATCH = 0 : SRCLK = 0 : SER = 0
c=0
start_ch_idx =0
end_ch_idx = 30
Loop:
PulsOut Rowrst,2 give a pulse on row reset pin, to select row 0
For i=0 To 6
ch_index = start_ch_idx
for n = 0 to 10
GoSub GetPatternAndOut
inc ch_index
if ch_index = end_ch_idx then ch_index =0
next n
PulsOut Latch,4
DelayUS 250
PulsOut RowClk,2
for n = 0 to 7
SHOut SER,SRCLK,lsbfirst,[0]
next n
PulsOut Latch,4

Next i
inc l
if l = 10 then
l=0
Inc start_ch_idx
If start_ch_idx = end_ch_idx Then start_ch_idx = 0
endif
GoTo Loop
End
GetPatternAndOut:
m = LRead LABEL+((serial_buffer[ch_index]) * 8) +i
m = ~m
out a clock pulse and restore data pin to 0
out the low 5 bits of pattern
SRCLK = 1 : SRCLK = 0: SER = 0
If m.4 = 1 Then SER = 1
SRCLK = 1 : SRCLK = 0: SER = 0
If m.3 = 1 Then SER = 1
SRCLK = 1 : SRCLK = 0: SER = 0
If m.2 = 1 Then SER = 1
SRCLK = 1 : SRCLK = 0: SER = 0
If m.1 = 1 Then SER = 1
SRCLK = 1 : SRCLK = 0: SER = 0
If m.0 = 1 Then SER = 1
SRCLK = 1 : SRCLK = 0: SER = 0
Return
LABEL:
LDATA $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF Space
LDATA $FB,$FB,$FB,$FB,$FB,$FF,$FB,$FF !
LDATA $F5,$F5,$F5,$FF,$FF,$FF,$FF,$FF
LDATA $F5,$F5,$E0,$F5,$E0,$F5,$F5,$FF #
LDATA $FB,$F0,$EB,$F1,$FA,$E1,$FB,$FF $
LDATA $E3,$EA,$E5,$FB,$F4,$EA,$F8,$FF %
LDATA $F7,$EB,$EB,$F7,$EA,$ED,$F2,$FF &
LDATA $F9,$F9,$FD,$FB,$FF,$FF,$FF,$FF
LDATA $FD,$FB,$F7,$F7,$F7,$FB,$FD,$FF (
LDATA $F7,$FB,$FD,$FD,$FD,$FB,$F7,$FF )
LDATA $FB,$EA,$F1,$FB,$F1,$EA,$FB,$FF *
LDATA $FF,$FB,$FB,$E0,$FB,$FB,$FF,$FF +
LDATA $FF,$FF,$FF,$F3,$F3,$FB,$F7,$FF ,
LDATA $FF,$FF,$FF,$F1,$FF,$FF,$FF,$FF -

LDATA $FF,$FF,$FF,$FF,$FF,$F3,$F3,$FF .
LDATA $FF,$FE,$FD,$FB,$F7,$EF,$FF,$FF /
LDATA $F1,$EE,$EC,$EA,$E6,$EE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