۰۸-تير-۱۳۸۶, ۰۹:۳۲:۱۵
سلام ، لطفاً اگه امکان داره الگوریتم این برنامه رو توضیح بدید تا یه چیزی ازش بفهمم
کد:
'----------------------------------------------------------
' (c) 1997-2003 MCS Electronics
' APPLICATION NOTE 1
'
'----------------------------------------------------------
$regfile = "M32def.dat"
$crystal = 8000000
Dim Mat(210) As Byte '7*30
Dim Buf(210) As Byte
Dim Char1 As Byte
Dim Char2 As Byte
Dim Lsh As Byte
Dim I As Byte
Dim J As Byte
Dim J2 As Byte
Dim Linebuf As Byte
Dim R As Byte
Dim Testbit As Byte
Dim N As Byte
Dim S As Byte
Dim Tmp As Byte
Dim Tmp2 As Byte
Dim Tmp3 As Byte
Dim Sum As Byte
Dim Charcon As Byte
Dim Charcur As Byte
Dim Cur As Integer
Config Porta = Output
Config Portb = Output
Porta = 0
Portb = 255
Cur = 0
For Cur = 1 To 210 'clear mat
Mat(cur) = 0
Next
For Cur = 1 To 210 'Clear Buf
Buf(cur) = 0
Next
Charcon = 5
Charcur = 0
Do
If Charcon >= 6 Then 'number of shift mat<=buf
'load new char to buf-------------------------------------
'read string ssssssssssssssssssssssssssssssssssssssssssssss
If Charcur = 25 Then Charcur = 0 'len of string
Tmp2 = Lookup(charcur , Mystr)
If Tmp2 = 32 Then
Tmp2 = 0
Else
Tmp2 = Tmp2 - 64
End If
Tmp2 = Tmp2 * 5
Charcon = 0
Incr Charcur
'read string ssssssssssssssssssssssssssssssssssssssssssssss
For J = 0 To 4
Testbit = 1
Tmp3 = Tmp2 + J
Char1 = Lookup(tmp3 , Data3) 'read row(j) if char map
For S = 0 To 7
Tmp = Char1 And Testbit
Shift Testbit , Left , 1
Sum = S * 30
Sum = Sum + J
Incr Sum
If Tmp <> 0 Then Buf(sum) = 1
Next
Next
'load new char-------------------------------------
End If
'For R = 1 To 3
'shift left<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'For J = 0 To 6
'For I = 2 To 30
'J2 = J * 30
'J2 = J2 + I
'Buf(j2 -1) = Buf(j2 )
'Next
'Next
'shift left<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'Next
Incr Charcon
'shift left<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
For J = 0 To 6
'scroolmat
For I = 2 To 30
J2 = J * 30
J2 = J2 + I
Mat(j2 -1) = Mat(j2 )
Next
Next
'shift left<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'shift left<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
For J = 0 To 6 'shift mat<=buf 1col
J2 = J * 30
Mat(j2 + 30) = Buf(j2 + 1)
For I = 2 To 30
J2 = J * 30
J2 = J2 + I
Buf(j2 -1) = Buf(j2 )
Next
Next
'shift left<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'shift right>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'For J = 0 To 6
'For I = 1 To 29
'J2 = J * 30
'Tmp = 30 - I
'J2 = J2 + Tmp
'Mat(j2 + 1 ) = Mat(j2 )
'Next
'Mat(j2) = 0
'Next
'shift right>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
'shift left<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'For J = 0 To 6
'For I = 2 To 30
'J2 = J * 30
'J2 = J2 + I
'Mat(j2 -1) = Mat(j2 )
'Next
'Next
'shift left<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
'Next
For Cur = 1 To 100
'start of display segment
For J = 0 To 6
'for 30 cols
For R = 1 To 30
J2 = J * 30
J2 = J2 + R
If Mat(j2) = 0 Then Porta.1 = 0 Else Porta.1 = 1 'serial bit for send
Porta.2 = 1 'clock for pick a bit rasing
Porta.2 = 0
Next
Porta.0 = 1 'clock for byte data load rasing
Porta.0 = 0
Portb.j = 0
Waitus 100
Portb.j = 1
Next
'end of display segment
Next
Loop
End
Mystr:
Data "IN THE NAME OF GOD "
Data3:
Data 0 , 0 , 0 , 0 , 0 'space
Data &H3F , &H44 , &H44 , &H44 , &H3F 'A
Data &H7F , &H49 , &H49 , &H49 , &H36 'B
Data &H3E , &H41 , &H41 , &H41 , &H22 'C
Data &H7F , &H41 , &H41 , &H22 , &H1C 'D
Data &H7F , &H49 , &H49 , &H49 , &H41 'E
Data &H7F , &H48 , &H48 , &H48 , &H40 'F
Data &H3E , &H41 , &H49 , &H49 , &H2F 'G
Data &H7F , &H08 , &H08 , &H08 , &H7F 'H
Data &H00 , &H41 , &H7F , &H41 , &H00 'I
Data &H02 , &H01 , &H41 , &H7E , &H40 'J
Data &H7F , &H08 , &H14 , &H22 , &H41 'K
Data &H7F , &H01 , &H01 , &H01 , &H01 'L
Data &H7F , &H20 , &H18 , &H20 , &H7F 'M
Data &H7F , &H10 , &H08 , &H04 , &H7F 'N
Data &H3E , &H41 , &H41 , &H41 , &H3E 'O
Data &H7F , &H48 , &H48 , &H48 , &H30 'P
Data &H3E , &H41 , &H45 , &H42 , &H3D 'Q
Data &H7F , &H48 , &H4C , &H4A , &H31 'R
Data &H31 , &H49 , &H49 , &H49 , &H46 'S
Data &H40 , &H40 , &H7F , &H40 , &H40 'T
Data &H7E , &H01 , &H01 , &H01 , &H7E 'U
Data &H7C , &H02 , &H01 , &H02 , &H7C 'V
Data &H7E , &H01 , &H06 , &H01 , &H7E 'W
Data &H63 , &H14 , &H08 , &H14 , &H63 'X
Data &H70 , &H08 , &H07 , &H08 , &H70 'Y
Data &H43 , &H45 , &H49 , &H51 , &H61 'Z