Preview of schematic:
Full schematic (jpg 1.1MB) can be downloaded here
BASCOM source :
$regfile = "m32def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 32
$framesize = 24
'---- this section from Gif Properties
Const Total_frame = 8
Const Width = 24
Const Height = 24
'---- end of Gif Properties
Const Number_of_matrix_in_row = Width / 8
Const Byte_in_col = Height / 8
Const Frame_size = Width * Byte_in_col
Const Number_of_byte_in_8_col = Byte_in_col * 8
Declare Sub Readframe(byval Frame_number As Word)
' Port A for COL refresh
Config Porta = Output
' Port D for 74595 register
Config Portd = Output
Config Timer0 = Timer , Prescale = 64 'Clock value: 15.625 kHz
On Ovf0 Refresh
Enable Timer0 ' enable the timer interrupt
Enable Interrupts
Sh_cp Alias Portd.3
Ds Alias Portd.4
St_cp Alias Portd.5
Mr Alias Portd.6
Oe Alias Portd.7
Col_port Alias Porta
Dim Col As Byte
Dim Buf(frame_size) As Byte
Dim I As Byte
Dim Matrix_counter As Word
Dim Buf_idx As Word
Dim Col_number_in_buf As Byte
Dim Frame_count As Word
Reset Mr
Set Mr
Reset Oe
Do
For Frame_count = 1 To Total_frame
Readframe Frame_count
Waitms 200
Next Frame_count
Loop
End 'end program
Sub Readframe(byval Frame_number As Word)
Local Idx As Word
Local Lookup_idx As Word
Disable Timer0
Decr Frame_number
'Start of Frame in lookup table
Lookup_idx = Frame_number * Frame_size
For Idx = 0 To Frame_size
Buf(idx) = Lookup(lookup_idx , Ani )
Incr Lookup_idx
Next Idx
Enable Timer0
End Sub
Refresh:
Reset Mr
Set Mr
Col_port = &H00
Set Oe
Col_port = 2 ^ Col
For Matrix_counter = 1 To Number_of_matrix_in_row
Col_number_in_buf = Number_of_matrix_in_row - Matrix_counter
Col_number_in_buf = Col_number_in_buf * Number_of_byte_in_8_col
Buf_idx = Col * Byte_in_col
Buf_idx = Buf_idx + Col_number_in_buf
For I = 1 To Byte_in_col
Shiftout Ds , Sh_cp , Buf(buf_idx) , 1 , 8
Incr Buf_idx
Next I
Next Matrix_counter
Reset St_cp
Set St_cp
Reset Oe
If Col < 7 Then
Incr Col
Else
Col = 0
End If
Return
'---- this delay table from Frame Properties
Delay:
'Frame 1
Data 200%
'Frame 2
Data 100%
'Frame 3
Data 100%
'Frame 4
Data 100%
'Frame 5
Data 100%
'Frame 6
Data 100%
'Frame 7
Data 100%
'Frame 8
Data 100%
Ani:
- HERE INSERT DATA CODE GENERATED BY TOOL BELOW -
Test Gif Animation
Sample Gif Animation (click to generate code)