Code:
'----------------------------------------------------------
' Programm initialisieren
'----------------------------------------------------------
'$dbg
'
' ACHTUNG JTAG per Fuse abschalten !!!!
'
$regfile = "m16def.dat"
$crystal = 16000000
$baud = 57600
On Urxc Zeichenempfang
Enable Urxc
Enable Interrupts
Dim D_byte As Byte
Dim Col As Byte
Dim Page As Byte
Dim Pointer As Byte
Pointer = 1
Dim X_byte As Byte
Dim Y_byte As Byte
Dim Z_byte As Byte
Dim Tempbyte As Byte
Ddrb = &B00011111
Config Spi = Hard , Interrupt = Off , Data Order = Msb , Master = Yes , Polarity = Low , Phase = 1 , Clockrate = 4 , Noss = 0
Spiinit
'----------------------------------------------------------
' LCD
'----------------------------------------------------------
A Alias Portb.0
Res Alias Portb.1
Cs1 Alias Portb.2
Cs2 Alias Portb.3
A = 1
Cs1 = 1
Cs2 = 0
Res = 0
Wait 2
Res = 1
A = 0
D_byte = &B10001100 ' Kontrast einstellen
Spiout D_byte , 1
D_byte = &B10100010 ' LCD Bias 1/6
Spiout D_byte , 1
D_byte = &B10100001 ' gespiegelte Anzeige
Spiout D_byte , 1
D_byte = &B00101111 ' internen Spannungswandler aktivieren
Spiout D_byte , 1
D_byte = &B10101111 ' display an
Spiout D_byte , 1
D_byte = &B01000100 ' start Dispay line
Spiout D_byte , 1
D_byte = 0
Waitms 50
X_byte = 1
A = 1
Gosub Clearglcd
' ########### Mainloop ########################################
Do
'Spiout X_byte , 1
'Incr Pointer
'If Pointer > 120 Then
' Incr Page
' If Page > 7 Then
' Page = 0
' Waitms 300
' Shift X_byte , Left , 1
' Incr X_byte
' If X_byte > 254 Then X_byte = 0
' End If
' A = 0
' D_byte = &B10110000
' D_byte = D_byte Or Page ' start Dispay Page
' Spiout D_byte , 1
' D_byte = &B00000000 ' auf Startposition zurück (CR)
' Spiout D_byte , 1
' Waitus 5
' A = 1
' Pointer = 0
'End If
Loop
End
' ################################################################
' ################################################################
Clearglcd:
X_byte = 0
For Page = 0 To 7
A = 0
D_byte = &B10110000
D_byte = D_byte Or Page ' start Dispay Page
Spiout D_byte , 1
D_byte = &B00000000 ' auf Startposition zurück (CR)
Spiout D_byte , 1
Waitus 5
A = 1
Pointer = 0
For Pointer = 1 To 125
Spiout X_byte , 1
Next
Next
A = 0
D_byte = &B10110001
Spiout D_byte , 1
D_byte = &B00000000 ' auf Startposition zurück (CR)
Spiout D_byte , 1
Waitus 5
A = 1
Page = 0
Return
End
' ################################################################
Timer_irq:
Return
End
' ################################################################
Zeichenempfang:
Tempbyte = Udr
Select Case Tempbyte:
Case 65:
Restore A
Case 66:
Restore B
Case 67:
Restore C
Case 68:
Restore D
Case 69:
Restore E
Case 70:
Restore F
Case 71:
Restore G
Case 72:
Restore H
Case 73:
Restore I
Case 74:
Restore J
Case 75:
Restore K
Case 76:
Restore L
Case 77:
Restore M
Case 78:
Restore N
Case 79:
Restore O
Case 80:
Restore P
Case 81:
Restore Q
Case 82:
Restore R
Case 83:
Restore S
Case 84:
Restore T
Case 85:
Restore U
Case 86:
Restore V
Case 87:
Restore W
Case 88:
Restore X
Case 89:
Restore Y
Case 90:
Restore Z
Case 97:
Restore A1
Case 98:
Restore B1
Case 99:
Restore C1
Case 100:
Restore D1
Case 101:
Restore E1
Case 102:
Restore F1
Case 103:
Restore G1
Case 104:
Restore H1
Case 105:
Restore I1
Case 106:
Restore J1
Case 107:
Restore K1
Case 108:
Restore L1
Case 109:
Restore M1
Case 110:
Restore N1
Case 111:
Restore O1
Case 112:
Restore P1
Case 113:
Restore Q1
Case 114:
Restore R1
Case 115:
Restore S1
Case 116:
Restore T1
Case 117:
Restore U1
Case 118:
Restore V1
Case 119:
Restore W1
Case 120:
Restore X1
Case 121:
Restore Y1
Case 122:
Restore Z1
Case 48:
Restore 0
Case 49:
Restore 1
Case 50:
Restore 2
Case 51:
Restore 3
Case 52:
Restore 4
Case 53:
Restore 5
Case 54:
Restore 6
Case 55:
Restore 7
Case 56:
Restore 8
Case 57:
Restore 9
Case 32:
Restore Leer
Case 46:
Restore Punkt
Case 44:
Restore Komma
Case 45:
Restore Strich
Case 58:
Restore Doppelpunkt
Case 176:
Restore Gradzeichen
Case 62:
Restore Pfeilrechts
Case 60:
Restore Pfeillinks
Case 228:
Restore Ae1
Case 246:
Restore Oe1
Case 252:
Restore Ue1
Case 196:
Restore Ae
Case 214:
Restore Oe
Case 220:
Restore Ue
Case 13: ' Zeilenumbruch
Gosub Cr_lf
Case 35:
Gosub Clearglcd
Tempbyte = 13
Case Else:
Restore Leer
Tempbyte = 13
End Select
If Tempbyte <> 13 Then
Incr Pointer
If Pointer > 19 Then
Gosub Cr_lf
Pointer = 1
End If
For Z_byte = 1 To 6
Read D_byte
Spiout D_byte , 1
Next
End If
'Udr = Tempbyte
'Print " " ; Pointer
Return
End
Cr_lf:
A = 0
Incr Page
If Page > 6 Then Page = 1
D_byte = &B10110000
D_byte = D_byte Or Page ' start Dispay Page
Spiout D_byte , 1
D_byte = &B00000000 ' auf Startposition zurück (CR)
Spiout D_byte , 1
Waitus 5
A = 1
Pointer = 0
Return
End
' ################################################################
' ****************** Daten (ASCII) *******************************
0:
Data &H00 , &H3E , &H51 , &H49 , &H45 , &H3E
1:
Data &H00 , &H00 , &H42 , &H7F , &H40 , &H00
2:
Data &H00 , &H42 , &H61 , &H51 , &H49 , &H46
3:
Data &H00 , &H22 , &H41 , &H49 , &H49 , &H36
4:
Data &H00 , &H18 , &H14 , &H12 , &H7F , &H10
5:
Data &H00 , &H27 , &H45 , &H45 , &H45 , &H39
6:
Data &H00 , &H3E , &H49 , &H49 , &H49 , &H32
7:
Data &H00 , &H61 , &H11 , &H09 , &H05 , &H03
8:
Data &H00 , &H36 , &H49 , &H49 , &H49 , &H36
9:
Data &H00 , &H26 , &H49 , &H49 , &H49 , &H3E
A:
Data &H00 , &H7C , &H12 , &H11 , &H12 , &H7C
Ae:
Data &H00 , &H7D , &H12 , &H11 , &H12 , &H7D
B:
Data &H00 , &H7F , &H49 , &H49 , &H49 , &H36
C:
Data &H00 , &H3E , &H41 , &H41 , &H41 , &H22
D:
Data &H00 , &H7F , &H41 , &H41 , &H41 , &H3E
E:
Data &H00 , &H7F , &H49 , &H49 , &H49 , &H41
F:
Data &H00 , &H7F , &H09 , &H09 , &H09 , &H01
G:
Data &H00 , &H3E , &H41 , &H49 , &H49 , &H3A
H:
Data &H00 , &H7F , &H08 , &H08 , &H08 , &H7F
I:
Data &H00 , &H00 , &H41 , &H7F , &H41 , &H00
J:
Data &H00 , &H20 , &H41 , &H41 , &H41 , &H3F
K:
Data &H00 , &H7F , &H08 , &H14 , &H22 , &H41
L:
Data &H00 , &H7F , &H40 , &H40 , &H40 , &H40
M:
Data &H00 , &H7F , &H02 , &H04 , &H02 , &H7F
N:
Data &H00 , &H7F , &H04 , &H08 , &H10 , &H7F
O:
Data &H00 , &H3E , &H41 , &H41 , &H41 , &H3E
Oe:
Data &H00 , &H3F , &H41 , &H41 , &H41 , &H3F
P:
Data &H00 , &H7F , &H09 , &H09 , &H09 , &H06
Q:
Data &H00 , &H3E , &H41 , &H51 , &H61 , &H7E
R:
Data &H00 , &H7F , &H09 , &H19 , &H29 , &H46
S:
Data &H00 , &H06 , &H49 , &H49 , &H49 , &H30
T:
Data &H00 , &H01 , &H01 , &H7F , &H01 , &H01
U:
Data &H00 , &H3F , &H40 , &H40 , &H40 , &H3F
Ue:
Data &H00 , &H3D , &H40 , &H40 , &H40 , &H3D
V:
Data &H00 , &H1F , &H20 , &H40 , &H20 , &H1F
W:
Data &H00 , &H7F , &H20 , &H10 , &H20 , &H7F
X:
Data &H00 , &H63 , &H14 , &H08 , &H14 , &H63
Y:
Data &H00 , &H03 , &H04 , &H78 , &H04 , &H03
Z:
Data &H00 , &H61 , &H51 , &H49 , &H45 , &H43
'Leerzeichen
Leer:
Data &H00 , &H00 , &H00 , &H00 , &H00 , &H00
'für Kleinbuchstaben
A1:
Data &H00 , &H30 , &H4A , &H4A , &H52 , &H7C
Ae1:
Data &H00 , &H31 , &H4A , &H4A , &H52 , &H7D
B1:
Data &H00 , &H3F , &H48 , &H44 , &H44 , &H38
C1:
Data &H00 , &H38 , &H44 , &H44 , &H44 , &H28
D1:
Data &H00 , &H38 , &H44 , &H44 , &H48 , &H7F
E1:
Data &H00 , &H38 , &H54 , &H54 , &H54 , &H18
F1:
Data &H00 , &H00 , &H04 , &H7E , &H05 , &H00
G1:
Data &H00 , &H0C , &H52 , &H52 , &H4A , &H3C
H1:
Data &H00 , &H7F , &H08 , &H04 , &H04 , &H78
I1:
Data &H00 , &H00 , &H44 , &H7D , &H40 , &H00
J1:
Data &H00 , &H00 , &H40 , &H44 , &H3D , &H00
K1:
Data &H00 , &H7F , &H20 , &H10 , &H28 , &H44
L1:
Data &H00 , &H00 , &H41 , &H7F , &H40 , &H00
M1:
Data &H00 , &H7C , &H04 , &H18 , &H04 , &H7C
N1:
Data &H00 , &H7C , &H08 , &H04 , &H04 , &H78
O1:
Data &H00 , &H38 , &H44 , &H44 , &H44 , &H38
Oe1:
Data &H00 , &H39 , &H44 , &H44 , &H44 , &H39
P1:
Data &H00 , &H7C , &H14 , &H24 , &H24 , &H18
Q1:
Data &H00 , &H18 , &H24 , &H24 , &H14 , &H7C
R1:
Data &H00 , &H7C , &H04 , &H04 , &H08 , &H00
S1:
Data &H00 , &H08 , &H54 , &H54 , &H54 , &H20
T1:
Data &H00 , &H04 , &H3F , &H44 , &H40 , &H00
Ue1:
Data &H00 , &H3D , &H40 , &H40 , &H40 , &H3D
U1:
Data &H00 , &H3C , &H40 , &H40 , &H40 , &H3C
V1:
Data &H00 , &H1C , &H20 , &H40 , &H20 , &H1C
W1:
Data &H00 , &H3C , &H40 , &H30 , &H40 , &H3C
X1:
Data &H00 , &H44 , &H28 , &H10 , &H28 , &H44
Y1:
Data &H00 , &H0C , &H50 , &H50 , &H48 , &H3C
Z1:
Data &H00 , &H44 , &H64 , &H54 , &H4C , &H44
'Sonderzeichen
Punkt:
Data &H00 , &H00 , &H60 , &H60 , &H00 , &H00
Komma:
Data &H00 , &H00 , &H60 , &HE0 , &H00 , &H00
Strich:
Data &H00 , &H18 , &H18 , &H18 , &H18 , &H00
Doppelpunkt:
Data &H00 , &H00 , &H6C , &H6C , &H00 , &H00
Gradzeichen:
Data &H00 , &H00 , &H07 , &H05 , &H07 , &H00
Pfeilrechts:
Data &H00 , &H41 , &H63 , &H36 , &H1C , &H08
Pfeillinks:
Data &H00 , &H08 , &H1C , &H36 , &H63 , &H41
' -----------------------------------------------------------------------
Zugegeben, vom Zeichensatz hab ich einiges abgespitzelt,
Lesezeichen