VIELEN VIELEN DANK!!! es geht:
es muss heißen:
Call Write_port (Xparameter)
Call Write_port (command)
und hier nun noch mal das vollständige Programm
für den M50530 LCD Controller:
Jetzt kann man natürlich noch die Do...Loopschleife von der LCD-Routine befreien und eine eigene LCD-Routine machen und so weiterCode:'******************************************* ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ';; LCD-Routinen für M50530 ;; ';; ======================= ;; ';; ;; ';; Titel : 4 Bit LCD M50530 ;; ';; ;; ';; 4bit-Interface M50530 ;; ';; ;; ';; DB4: PD5 ;; ';; DB5: PD6 ;; ';; DB6: PD7 ;; ';; DB7: PB0 ;; ';; ;; ';; OC1: PD3 ;; ';; OC2: PD4 ;; ';; EX : PC2 ;; ';; ;; ';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; '***************************************** $regfile = "m8def.dat" ' IC-Typ $crystal = 3686400 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 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) 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 Reset Oc1 Reset Oc2 Reset Ex '------------ '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 Call Write_port(xparameter) 'Lcddisplay = Xparameter Set Ex Waitus 1 Reset Ex Call 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
gruß, Tobias







Zitieren

Lesezeichen