die beide Befehle mag Bascom nicht:
Write_port(Xparameter)
'bzw.
Write_port(Command)
hoffe ich hab da nichts an der falschen Stelle eingefügt...
Code:
$regfile = "m8def.dat" ' IC-Typ
$crystal = 3686400
Config Portd.5 = Output
Config Portd.6 = Output
Config Portd.7 = Output
Config Portb.0 = Output
Oc1 Alias Portd.3
Config Oc1 = Output
Oc2 Alias Portd.4
Config Oc2 = Output
Ex Alias Portc.2
Config Ex = Output
Dim Parameter As Byte
Dim Xparameter As Byte
Dim Command As Byte
Dim Zeile As Byte
Dim I As Byte
Dim Char As Byte
Dim Xchar As String * 1
Dim Text As String * 16
Dim Xxchar As String * 1
Dim Xxxchar As Byte
Dim Xport As Byte
Dim Test_zahl As Byte
Reset Oc1
Reset Oc2
Reset Ex
Declare Sub Init()
Declare Sub Command(command As Byte)
Declare Sub Disp(xchar As Byte)
Declare Sub Zeile(xzeile As Byte)
Declare Sub Write_port(xport as byte)
'------------
'Hautprogramm
'------------
Call Init
Do
Zeile = $00
Call Zeile(zeile)
Text = "Test: " + Str(test_zahl) '"0123456789ABCDEF"
Gosub Ausgeben
Zeile = $40
Call Zeile(zeile)
Text = "GHIJKLMNOPQRSTUV"
Gosub Ausgeben
Zeile = $80
Call Zeile(zeile)
Text = "WXYZ!,$%&/()=?`*"
Gosub Ausgeben
Zeile = $c0
Call Zeile(zeile)
Text = "@+#'<>|^{[]};_-."
Gosub Ausgeben
Wait 1
Incr Test_zahl
Loop
'------------------
'Ende Hauptprogramm
'------------------
Sub Write_port(xport as byte)
Portd.5 = xport.0
Portd.6 = xport.1
Portd.7 = xport.2
Portb.0 = xport.3
End Sub
'----------
Sub Init()
'----------
Parameter = $d8
Call Command(parameter)
Parameter = $50
Call Command(parameter)
Parameter = $33
Call Command(parameter)
Parameter = $01
Call Command(parameter)
Waitms 2
End Sub
'-----------------------------
Sub Command(command As Byte)
'-----------------------------
Xparameter = Command
Shift Xparameter , Right , 4
Write_port = Xparameter 'Lcddisplay = Xparameter
Set Ex
Waitus 1
Reset Ex
Write_port = Command 'Lcddisplay = Command And $0f
Set Ex
Waitus 1
Reset Ex
Waitus 20
End Sub
'--------------------------
Sub Zeile(xzeile As Byte)
'--------------------------
Parameter = Xzeile
Set Oc1
Set Oc2
Call Command(parameter)
Reset Oc1
Reset Oc2
Waitus 100
End Sub
'------------------------
Sub Disp(xchar As Byte)
'------------------------
Set Oc2
Parameter = Xchar
Call Command(parameter)
Reset Oc2
End Sub
'---------
Ausgeben:
'---------
For I = 1 To 16
Xxchar = Mid(text , I , 1)
Xxxchar = Val(xxchar)
Char = Asc(xxchar)
If Char = 0 Then
Char = $20
End If
Call Disp(char)
Next I
Return
Lesezeichen