$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:
Data &H18, &H00, &H18 '...##..............##...
Data &H30, &H00, &H0C '..##................##..
Data &H6F, &HF7, &HE6 '.##.########.######..##.
Data &HDF, &HFC, &H23 '##.###########....#...##
Data &HBF, &HFE, &H21 '#.#############...#....#
Data &H00, &H7F, &H20 '.........#######..#.....
Data &H00, &HFF, &HA0 '........#########.#.....
Data &H3F, &HEF, &HE0 '..#########.#######.....
Data &H3F, &HDB, &HE0 '..########.##.#####.....
Data &H37, &H91, &HDE '..##.####..#...###.####.
Data &H00, &H17, &HBF '...........#.####.######
Data &H00, &H3C, &H3F '..........####....######
Data &H30, &HE0, &H3F '..##....###.......######
Data &H38, &H40, &H3F '..###....#........######
Data &H3C, &H80, &H1E '..####..#..........####.
Data &H3E, &H80, &H00 '..#####.#...............
Data &H3F, &H00, &H00 '..######................
Data &H3D, &H00, &H00 '..####.#................
Data &H3A, &H00, &H00 '..###.#.................
Data &HB6, &H00, &H01 '#.##.##................#
Data &HC6, &H00, &H03 '##...##...............##
Data &H6C, &H00, &H06 '.##.##...............##.
Data &H3C, &H00, &H0C '..####..............##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 2
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H90, &HDE '..##.####..#....##.####.
Data &H00, &H3F, &HBF '..........#######.######
Data &H00, &H10, &H3F '...........#......######
Data &H30, &H20, &H3F '..##......#.......######
Data &H38, &H20, &H3F '..###.....#.......######
Data &H3C, &H20, &H1E '..####....#........####.
Data &H3E, &H40, &H00 '..#####..#..............
Data &H3E, &H40, &H00 '..#####..#..............
Data &H3C, &H40, &H00 '..####...#..............
Data &H38, &HC0, &H00 '..###...##..............
Data &HB1, &H80, &H01 '#.##...##..............#
Data &HC1, &H80, &H03 '##.....##.............##
Data &H61, &H80, &H06 '.##....##............##.
Data &H31, &H80, &H0C '..##...##...........##..
Data &H18, &H80, &H18 '...##...#..........##...
' Frame 3
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H18, &H00 '..#####....##...........
Data &H3C, &H18, &H00 '..####.....##...........
Data &H38, &H18, &H00 '..###......##...........
Data &HB0, &H18, &H01 '#.##.......##..........#
Data &HC0, &H18, &H03 '##.........##.........##
Data &H60, &H08, &H06 '.##.........#........##.
Data &H30, &H00, &H0C '..##................##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 4
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H1C, &H00 '..#####....###..........
Data &H3C, &H1C, &H00 '..####.....###..........
Data &H38, &H1C, &H00 '..###......###..........
Data &HB0, &HDC, &H01 '#.##....##.###.........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H61, &HA8, &H06 '.##....##.#.#........##.
Data &H30, &H20, &H0C '..##......#.........##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 5
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H1C, &H00 '..#####....###..........
Data &H3C, &H1C, &H00 '..####.....###..........
Data &H38, &H1C, &H00 '..###......###..........
Data &HB1, &H9C, &H01 '#.##...##..###.........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H63, &H48, &H06 '.##...##.#..#........##.
Data &H30, &H40, &H0C '..##.....#..........##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 6
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H3E, &H00 '..#####...#####.........
Data &H3C, &H3E, &H00 '..####....#####.........
Data &H38, &H3E, &H00 '..###.....#####.........
Data &HB3, &H3E, &H01 '#.##..##..#####........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H66, &HC8, &H06 '.##..##.##..#........##.
Data &H30, &HC0, &H0C '..##....##..........##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 7
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H3E, &H00 '..#####...#####.........
Data &H3C, &H3E, &H00 '..####....#####.........
Data &H38, &H3E, &H00 '..###.....#####.........
Data &HBC, &H3E, &H01 '#.####....#####........#
Data &HC0, &H1C, &H03 '##.........###........##
Data &H7B, &H08, &H06 '.####.##....#........##.
Data &H33, &H00, &H0C '..##..##............##..
Data &H18, &H00, &H18 '...##..............##...
' Frame 8
' Delay : 100ms
Data &H18, &H10, &H18 '...##......#.......##...
Data &H30, &H0F, &HEC '..##........#######.##..
Data &H6F, &HFC, &H26 '.##.##########....#..##.
Data &HDF, &HFF, &H23 '##.#############..#...##
Data &HBF, &HFF, &H21 '#.##############..#....#
Data &H00, &H7F, &HA0 '.........########.#.....
Data &H00, &HFF, &HE0 '........###########.....
Data &H3F, &HEB, &HE0 '..#########.#.#####.....
Data &H3F, &HC9, &HE0 '..########..#..####.....
Data &H37, &H88, &HDE '..##.####...#...##.####.
Data &H00, &H1F, &HBF '...........######.######
Data &H00, &H08, &H3F '............#.....######
Data &H30, &H08, &H3F '..##........#.....######
Data &H38, &H08, &H3F '..###.......#.....######
Data &H3C, &H08, &H1E '..####......#......####.
Data &H3E, &H08, &H00 '..#####.....#...........
Data &H3E, &H3E, &H00 '..#####...#####.........
Data &H3C, &H3E, &H00 '..####....#####.........
Data &H38, &H3E, &H00 '..###.....#####.........
Data &HB0, &H3E, &H01 '#.##......#####........#
Data &HF0, &H1C, &H03 '####.......###........##
Data &H70, &H08, &H06 '.###........#........##.
Data &H30, &H00, &H0C '..##................##..
Data &H18, &H00, &H18 '...##..............##...
untuk arduino uni bisa nggak?
BalasHapusAku belum coba karena butuh banyak port dan pakai bahasa bascom avr
BalasHapus