1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
| ' * Description: Scrolled to left
' *modified by: supra
' * Test configuration:
' MCU: PIC16F628A
' Misc: 74hc595; 8*32 dot matrix
' Oscillator: 20.0000 MHz
' config: PWRITE_ON, WDT_OFF, LVP_OFF, HS
' Ext. Modules: -
' SW: mikroBasic V7.0.0.2
program text 'With 74HC595: RA0 = Data, RA1 = Clock, RA2 = Latch
const text as integer[262] =(
$7F, $09, $09, $09, $06, $00, ' P
$41, $7F, $41, $00, ' I
$3E, $41, $41, $41, $22, $00,' C
$42, $7F, $40, $00, ' 1
$3C, $4A, $49, $49, $30, $00,' 6
$7F, $09, $09, $01, $01, $00,' F
$3C, $4A, $49, $49, $30, $00,' 6
$42, $61, $51, $49, $46, $00,' 2
$36, $49, $49, $49, $36, $00,' 8
$7E, $11, $11, $11, $7E, $00,' A
$00, $00, $00, $00, $00, $00,' space
$7F, $20, $18, $20, $7F, $00,' W
$44, $7D, $40, $00, ' i
$04, $3F, $44, $40, $20, $00, 't
$7F, $08, $04, $04, $78, $00, 'h
$00, $00, $00, $00, $00, $00,' space
$01, $71, $09, $05, $03, $00,' 7
$18, $14, $12, $7F, $10, $00,' 4
$7F, $08, $08, $08, $7F, $00,' H
$3E, $41, $41, $41, $22, $00,' C
$00, $42, $7F, $40, $00, ' 1
$27, $45, $45, $45, $39, $00,' 5
$18, $14, $12, $7F, $10, $00,' 4
$00, $00, $00, $00, $00, $00,' space
$36, $49, $49, $49, $36, $00,' 8
$63, $14, $08, $14, $63, $00,' X
$21, $41, $45, $4B, $31, $00,' 3
$42, $61, $51, $49, $46, $00,' 2
$00, $00, $00, $00, $00, $00,' space
$7F, $02, $04, $02, $7F, $00,' M
$20, $54, $54, $54, $78, $00, 'a
$04, $3F, $44, $40, $20, $00, 't
$7C, $08, $04, $04, $08, $00, 'r
$44, $7D, $40, $00, 'i
$44, $28, $10, $28, $44, $00, 'x
$00, $00, $00, $00, $00, $00,' space
$7F, $02, $04, $02, $7F, $00,' M
$44, $7D, $40, $00, 'i
$7F, $10, $28, $44, $00, 'k
$7C, $08, $04, $04, $08, $00, 'r
$38, $44, $44, $44, $38, $00, 'o
$7F, $49, $49, $49, $36, $00,' B
$20, $54, $54, $54, $78, $00, 'a
$48, $54, $54, $54, $24, $00, 's
$44, $7D, $40, $00, 'i
$38, $44, $44, $44, $44, $00) 'c
dim i, x as byte
dim temp_array as byte[32]
dim shift, a, value, column as integer
'dim number as word
'dim txt as string[5]
dim number as byte
dim y as byte
'===============================================================================
sub procedure Clock
PORTA.1 = 1 'portA.1 is high
nop 'no operation
PORTA.1 = 0 'portA.1 is low
end sub
'===============================================================================
sub procedure Latch
PORTA.2 = 1 'portA.2 is high
nop 'no operation
PORTA.2 = 0 'portA.2 is low
end sub
'===============================================================================
sub procedure Output(dim value as byte)
dim x as byte
PORTA.2 = 0 ' make Latch bit2 of portA low
for x = 0 to 7 ' loops for a count of eight
PORTA.0 = value.x
Clock
next x
PORTA.2 = 1 ' make Latch bit high to latch new data to the outputs
' of the HC595.
Latch
end sub
main:
'Set int Port operations
trisb = 0
trisa = 0
portb = 0
porta = 0
cmcon = 7
i = 0
a = 0
x = 0
column = 0
shift = 0
value = 0
start:
' Calculate the number of columns in the text
column = 262
'Temporary array reset
for i = 0 to 31
temp_array[i] = 0 'Array elements start out 0
next i
while true
'Shift operations
for shift = -32 to column 'prolong spaces to repeat again
'16 columns of text divided into pieces
for i = 0 to 31
value = i + shift
if(value > 0) then
temp_array[i] = 0 ' text input
end if
if(value >= 0) and (value <= column - 1) then
temp_array[i] = text[value]
end if
if(value > column) then
temp_array[i] = 0
end if
next i
'Scanning process
for a = 0 to 25 'control scrolling speeds...highuer number is slowest and lowest number is fastest
for x = 0 to 31 'Temporary array view
ClearBit(PORTA, i) 'Clear the Ghost locations ready for starting
portb.i = 0
portb = temp_array[x] 'send data to PortB
porta = x 'select the corresponding column
Next x
next a
next shift
wend
goto start
end. |