Project name:
' vertical up from centre to top right
' ' ' * Description:
' This code demonstrates scrolling messages vertical up from bottom to top right
' on 8x32 dor matrix, 2x74hc154.
' * Test configuration:
' MCU: PIC16F628A
'' Oscillator: HS, 20.000 MHz
' config: PWRITE_ON, WDT_OFF, LVP_OFF, HS
' Ext. Modules: None
' SW: mikroBasic v7.2
' date: March 18th, 2010
' * NOTES:
program vertical_up_centre_to_top_right
const supra as byte[30] = (
$00, $46, $49, $49, $49, $31,' // S
$00, $3F, $40, $40, $40, $3F,' // U
$00, $7F, $09, $09, $09, $06,' // P
$00, $7F, $09, $19, $29, $46,' // R
$00, $7E, $11, $11, $11, $7E)' // A
dim i, x as byte
dim temp_array as byte[32]
dim shift, a, value, column as integer
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 = 30
'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 = 0 to column 'prolong spaces to repeat again
'32 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] = supra[value]
end if
if(value > column) then
temp_array[i] = 0
end if
next i
'Scanning process
for a = 0 to 35 '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] >> shift 'send data to PortB
porta = x 'select the corresponding column
Next x
nop
nop
' delay_us(1000)
next a
next shift
wend
goto start
end.