Led Sign Tool by Hossein Lachini

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 -


Back to tools index




Test Gif Animation
Test Gif Animation

Sample Gif Animation (click to generate code)

'****************************************************
'* This Code Generate By : Hossein Lachini          *
'* The GIF Animation to Hex Code for LED Sign Board *
'* For to get more details visit :                  *
'*                           www.HLachini.com       *
'* Contact to me by : eLachini@Gmail.com            *
'* Mobile/SMS :              +98 912 381 2060       *
'****************************************************
' Width  : 24
' Height : 24
' Toltal Frame  : 2


' Frame 1
' Delay : 500ms
Data &H00, &H00, &H00 '........................
Data &H03, &H80, &H00 '......###...............
Data &H05, &H00, &H00 '.....#.#................
Data &H0A, &H00, &H00 '....#.#.................
Data &H12, &H00, &H00 '...#..#.................
Data &H13, &H9F, &H80 '...#..###..######.......
Data &H20, &HE0, &H60 '..#.....###......##.....
Data &H20, &H00, &H18 '..#................##...
Data &H20, &H00, &H04 '..#..................#..
Data &H40, &H41, &H08 '.#.......#.....#....#...
Data &H43, &H40, &H10 '.#....##.#.........#....
Data &H42, &H48, &H20 '.#....#..#..#.....#.....
Data &H43, &H90, &H20 '.#....###..#......#.....
Data &H40, &H10, &H20 '.#.........#......#.....
Data &H40, &H08, &H20 '.#..........#.....#.....
Data &H40, &H10, &H20 '.#.........#......#.....
Data &H40, &H10, &H20 '.#.........#......#.....
Data &H20, &H08, &H10 '..#.........#......#....
Data &H20, &H00, &H08 '..#.................#...
Data &H10, &H01, &H04 '...#...........#.....#..
Data &H0B, &H40, &H18 '....#.##.#.........##...
Data &H06, &H60, &H60 '.....##..##......##.....
Data &H03, &H9F, &H80 '......###..######.......
Data &H00, &H00, &H00 '........................

' Frame 2
' Delay : 500ms
Data &H00, &H00, &H00 '........................
Data &H1C, &H00, &H00 '...###..................
Data &H0A, &H00, &H00 '....#.#.................
Data &H05, &H00, &H00 '.....#.#................
Data &H09, &H00, &H00 '....#..#................
Data &H09, &HCF, &HC0 '....#..###..######......
Data &H10, &H70, &H30 '...#.....###......##....
Data &H10, &H00, &H0C '...#................##..
Data &H10, &H00, &H02 '...#..................#.
Data &H20, &H20, &H84 '..#.......#.....#....#..
Data &H21, &HA0, &H08 '..#....##.#.........#...
Data &H21, &H22, &H10 '..#....#..#...#....#....
Data &H21, &HCC, &H10 '..#....###..##.....#....
Data &H20, &H14, &H10 '..#........#.#.....#....
Data &H20, &H12, &H10 '..#........#..#....#....
Data &H20, &H14, &H10 '..#........#.#.....#....
Data &H20, &H0C, &H10 '..#.........##.....#....
Data &H10, &H02, &H08 '...#..........#.....#...
Data &H10, &H00, &H04 '...#.................#..
Data &H08, &H00, &H82 '....#...........#.....#.
Data &H05, &HA0, &H0C '.....#.##.#.........##..
Data &H03, &H30, &H30 '......##..##......##....
Data &H01, &HCF, &HC0 '.......###..######......
Data &H00, &H00, &H00 '........................