Latest Post :
Loading...
Home » » Menampilkan Teks Berjalan dengan Dot Matrix 5x7 melalui Hyperterminal

Menampilkan Teks Berjalan dengan Dot Matrix 5x7 melalui Hyperterminal

Friday, 8 July 2011 | 0 comments

Menampilkan Teks Berjalan dengan Dot Matrix 5x7 melalui Hyperterminal (Display Running Text using Dot Matrix 5x7 from Hyperterminal)




Dot matrix merupakan deretan led yang membentuk array dengan jumlah kolom dan baris tertentu, sehingga titik-titik yang menyala dapat membentuk suatu karakter angka, huruf, tanda baca, dsb. Program dot matrix 5x7 berikut menggunakan shift register 74HC595 untuk mengendalikan nyala array led, dan input teks melalui Hyperterminal. Jika dotmatrix tidak menggunakan shift register, maka led bisa menyala bersamaan satu kolom atau satu baris, berbeda dengan array button karena button hanya tersambung jika ditekan, sedangkan led selalu tersambung.


Rangkaian di dalam dot matrix 5x7 untuk common anoda dan common catoda adalah sbb:



Simulasi dengan proteus:



Untuk program ini panjang karakter running text adalah 160, tapi tak masalah untuk berapapun sampai maksimal kapasitas string karakter Bascom AVR, yang penting menambahkan jumlah array pada variabel Text, karena maksimal karakter untuk setiap array adalah 40, kalau lebih dari 45 dot matrix tidak akan berjalan. 

Listing program dot matrix 5x7 dengan Bascom AVR:

'===============================================================
'DOTMATRIX 5x7 DISPLAY

'PROGRAMMER = WAHYU RAHMANIAR
'COMPANY = TECHNOLOGINATION 
'===============================================================

$regfile = "m32def.dat"
$crystal = 8000000
$baud = 9600

Dim Char As Byte , C As Byte , Digit As Byte , L As Byte , I As Byte , Temp(2) As Byte , Temp2 As Byte
Dim X As Word, Y As Integer
Dim Str_temp As String * 1 , Reeks(250) As Byte

Dim Str_text As String * 160 , Str_len As Byte , Col_len As Byte , R As Byte
Dim Tempmsb As Byte , Templsb As Byte , Tempstr As String * 2
Dim Scroll_speed As Byte
Dim Text(4) As String * 40  

Declare Sub Show_text
Declare Sub Set_volt
Declare Sub Set_text
Declare Sub Test_display
Declare Sub Read_volt
Declare Sub Read_temp

Config Portc = Output                                       'shift register 74HC595
Config Portb = Output                                       'Dotmatrix 8x8

Goto Main

Sub Set_text
C = 1
For Digit = 1 To Str_len
Str_temp = Mid(str_text , Digit , 1)
Char = Asc(str_temp)
X = Char * 5
For I = 1 To 5
Reeks(c) = Lookup(x , Text_data)
X = X + 1
C = C + 1
Next I
Reeks(c) = 0
C = C + 1
Next Digit
End Sub Set_string

'show text
Sub Show_text
If Str_len > 4 Then

For L = 0 To Col_len
C = 1
   For R = 1 To Scroll_speed
       Set Portc.0
       Toggle Portc.1
       Toggle Portc.1
       Toggle Portc.2
       Toggle Portc.2
       Char = C + L
       Portb = Reeks(char)
       Waitms 1
       C = C + 1
       Reset Portc.0
       For X = 1 To 19
       Toggle Portc.1
       Toggle Portc.1
       Toggle Portc.2
       Toggle Portc.2
       Char = C + L
       Portb = Reeks(char)
       Waitms 1
       C = C + 1
       Next X
       C = 1
  Next R
Next L

Else

For L = 0 To Col_len
C = 1
   For R = 1 To Scroll_speed
       Set Portc.0
       Toggle Portc.1
       Toggle Portc.1
       Toggle Portc.2
       Toggle Portc.2
       Portb = Reeks(c)
       Waitms 1
       C = C + 1
       Reset Portc.0
       For X = 1 To 19
       Toggle Portc.1
       Toggle Portc.1
       Toggle Portc.2
       Toggle Portc.2
       Portb = Reeks(c)
       Waitms 1
       C = C + 1
       Next X
       C = 1
  Next R
Next L

End If

End Sub Show_text

Sub Test_display
Portb = 255
For X = 1 To 20
       Set Portc.0
       Toggle Portc.1
       Toggle Portc.1
       Toggle Portc.2
       Toggle Portc.2
Next X
End Sub Test_display

'---------------------

Main:

Call Test_display
Waitms 100
Scroll_speed = 16
Call Set_text
Do
Input "Masukkan Text (max 50): " , Str_text
Text(1) = Mid(str_text , 1 , 40)
Text(2) = Mid(str_text , 41 , 40)
Text(3) = Mid(str_text , 81 , 40)
Text(4) = Mid(str_text , 121 , 40)

For Y = 1 To 4
Str_text = Text(y)
Str_len = Len(str_text)
Col_len = Str_len * 6
Call Set_text
Call Show_text
Next

Loop
End


Text_data:
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      '
Data 0 , 0 , 0 , 0 , 0                                      'space
Data 0 , 0 , 95 , 0 , 0                                     '!
Data 0 , 7 , 0 , 7 , 0                                      ''
Data 20 , 127 , 20 , 127 , 20                               '#
Data 36 , 42 , 127 , 42 , 18                                '$
Data 39 , 21 , 107 , 84 , 114                               '%
Data 54 , 73 , 86 , 32 , 80                                 '&
Data 0 , 0 , 11 , 7 , 0                                     ''
Data 0 , 28 , 34 , 65 , 0                                   ' (
Data 0 , 65 , 34 , 28 , 0                                   ')
Data 42 , 28 , 127 , 28 , 42                                '*
Data 8 , 8 , 62 , 8 , 8                                     '+
Data 0 , 88 , 56 , 0 , 0                                    ',
Data 8 , 8 , 8 , 8 , 8                                      '-
Data 0 , 96 , 96 , 0 , 0                                    '.
Data 32 , 16 , 8 , 4 , 2                                    '/
Data 62 , 81 , 73 , 69 , 62                                 '0
Data 0 , 66 , 127 , 64 , 0                                  '1
Data 114 , 73 , 73 , 73 , 70                                '2
Data 34 , 65 , 73 , 73 , 54                                 '3
Data 24 , 20 , 18 , 127 , 16                                '4
Data 39 , 69 , 69 , 69 , 57                                 '5
Data 60 , 74 , 73 , 73 , 48                                 '6
Data 1 , 113 , 9 , 5 , 3                                    '7
Data 54 , 73 , 73 , 73 , 54                                 '8
Data 6 , 73 , 73 , 41 , 30                                  '9
Data 0 , 54 , 54 , 0 , 0                                    ':
Data 0 , 91 , 59 , 0 , 0                                    ';
Data 8 , 20 , 34 , 65 , 0                                   '<
Data 20 , 20 , 20 , 20 , 20                                 '=
Data 0 , 65 , 34 , 20 , 8                                   '>
Data 2 , 1 , 81 , 9 , 6                                     '?
Data 50 , 73 , 121 , 65 , 62                                '@
Data 124 , 18 , 17 , 18 , 124                               'A
Data 65 , 127 , 73 , 73 , 62                                'B
Data 62 , 65 , 65 , 65 , 34                                 'C
Data 65 , 127 , 65 , 65 , 62                                'D
Data 127 , 73 , 73 , 65 , 65                                'E
Data 127 , 9 , 9 , 1 , 1                                    'F
Data 62 , 65 , 73 , 73 , 58                                 'G
Data 127 , 8 , 8 , 8 , 127                                  'H
Data 0 , 65 , 127 , 65 , 0                                  'I
Data 32 , 64 , 65 , 63 , 1                                  'J
Data 127 , 8 , 20 , 34 , 65                                 'K
Data 127 , 64 , 64 , 64 , 64                                'L
Data 127 , 2 , 12 , 2 , 127                                 'M
Data 127 , 2 , 4 , 8 , 127                                  'N
Data 62 , 65 , 65 , 65 , 62                                 'O
Data 127 , 9 , 9 , 9 , 6                                    'P
Data 62 , 65 , 65 , 33 , 94                                 'Q
Data 127 , 9 , 25 , 41 , 70                                 'R
Data 38 , 73 , 73 , 73 , 50                                 'S
Data 1 , 1 , 127 , 1 , 1                                    'T
Data 63 , 64 , 64 , 64 , 63                                 'U
Data 7 , 24 , 96 , 24 , 7                                   'V
Data 127 , 32 , 24 , 32 , 127                               'W
Data 99 , 20 , 8 , 20 , 99                                  'X
Data 3 , 4 , 120 , 4 , 3                                    'Y
Data 97 , 81 , 73 , 69 , 67                                 'Z
Data 0 , 127 , 65 , 65 , 0                                  '[
Data 2 , 4 , 8 , 16 , 32                                    '\
Data 0 , 65 , 65 , 127 , 0                                  ']
Data 4 , 2 , 1 , 2 , 4                                      '^
Data 64 , 64 , 64 , 64 , 64                                 '_
Data 0 , 0 , 7 , 11 , 0                                     ''
Data 32 , 84 , 84 , 84 , 56                                 'a
Data 127 , 40 , 68 , 68 , 56                                'b
Data 0 , 56 , 68 , 68 , 68                                  'c
Data 56 , 68 , 68 , 40 , 127                                'd
Data 56 , 84 , 84 , 84 , 24                                 'e
Data 8 , 126 , 9 , 9 , 2                                    'f
Data 8 , 84 , 84 , 84 , 60                                  'g
Data 127 , 16 , 8 , 8 , 112                                 'h
Data 0 , 68 , 125 , 0 , 0                                   'i
Data 32 , 64 , 68 , 61 , 0                                  'j
Data 0 , 127 , 16 , 40 , 68                                 'k
Data 0 , 65 , 127 , 64 , 0                                  'l
Data 124 , 4 , 120 , 4 , 120                                'm
Data 124 , 8 , 4 , 4 , 120                                  'n
Data 56 , 68 , 68 , 68 , 56                                 'o
Data 124 , 20 , 20 , 20 , 8                                 'p
Data 8 , 20 , 20 , 20 , 124                                 'q
Data 124 , 8 , 4 , 4 , 8                                    'r
Data 72 , 84 , 84 , 84 , 36                                 's
Data 0 , 4 , 63 , 68 , 68                                   't
Data 60 , 64 , 64 , 32 , 124                                'u
Data 28 , 32 , 64 , 32 , 28                                 'v
Data 60 , 64 , 60 , 64 , 60                                 'w
Data 68 , 40 , 16 , 40 , 68                                 'x
Data 12 , 80 , 80 , 80 , 60                                 'y
Data 68 , 100 , 84 , 76 , 68                                'z
Data 0 , 8 , 54 , 65 , 0                                    '{
Data 0 , 0 , 119 , 0 , 0                                    '|
Data 0 , 65 , 54 , 8 , 0                                    '}
Data 2 , 1 , 2 , 4 , 2                                      '~
Data 42 , 85 , 42 , 85 , 42                                 ' 


atau download aja langsung simulasi dot matrix 5x7 dan source code lengkap.


Referensi...!
Share this article :

No comments:

 
Support : Creating Website | D'ELGER Template | FadeL
Copyright © 2013. LOGIKA D'ELGER - All Rights Reserved
Template Modify by Creating Website
Proudly powered by Blogger