LCD EDT EW20400GLW ks0066 20x4 4-bit modus no E2-pin
Moin
aufbau funktioniert mit algorithmen builder progy
fange mit bascom an
will nicht seit 12 stunden
was mach ich falsch ???
code hab ich von hier gemobst und variert
thx for help
thx Dirk so wollt ich das haben
ich guck nochmal wie es geht
Moin
aufbau funktioniert mit algorithmen builder progy
fange mit bascom an
will nicht seit 12 stunden
was mach ich falsch ???
code hab ich von hier gemobst und variert
thx for help
thx Dirk so wollt ich das haben
ich guck nochmal wie es geht
Code:
$regfile = "m8def.dat"
$crystal = 14745600 ' used crystal frequency
$baud = 115200 ' use baud rate
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 30 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space
$sim
disable interrupts
' LCD >> EDT EW20400GLW 20x4 KS0066 no E2-PIN
declare sub Lcdwrite(byval Zeichen As Byte)
declare sub Lcdwritehh(byval Zeichen As Byte)
initlcd
Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portd.7 , Rs = Portb.0
config PORTC = &B00001111
config PORTd.7 = output
config PORTb.0 = output
' You can also use a number for state. &B00001111, will set the upper
'nibble to input and the lower nibble to output.
RS alias Portb.0
En alias PortD.7
waitms 20
' Call Lcdwritehh(&B00000001) 'disp clear
'waitms 15
Call Lcdwritehh(&B00110000) 'clear 0000 0001
waitms 15 '00110000 -> 00000011
Call Lcdwritehh(&B00110000)
waitms 5 '00110000
Call Lcdwritehh(&B00110000) '00110000#
waitms 2
Call Lcdwritehh(&B00100000) '8 to 4 bit
waitms 5
Call Lcdwrite(&B00101100) 'funkt 0010 N F x x
'waitms 2
Call Lcdwrite(&B00101100)
'waitms 2 'disp on 0000 1 D C B
Call Lcdwrite(&B00001111)
' waitms 2
Call Lcdwrite(&B00000001) 'disp clear
'waitms 2
Call Lcdwrite(&B00000110)
'###########
Do
Waitms 1000
Locate 1 , 1
Lcd "1111111111"
print "123123"
Waitms 100
Locate 2 , 1
Lcd "222222222222"
Waitms 100
Locate 3 , 1
Lcd "33333333333333"
Waitms 100
Locate 4 , 1
Lcd "4444444444"
Wait 3
cls
Loop
'Db4 = Portc.3
'Db5 = Portc.2
'Db6 = Portc.1
'Db7 = Portc.0
'Rs = Portb.0
'E = PortD.7
'Schreibt die Initialisierungs - Bits zum LCD
Sub Lcdwrite(byval Zeichen As Byte)
' Höherwertiges Nibble setzen
reset RS
If Zeichen.4 = 1 Then set PORTC.0 Else reset PORTC.0
If Zeichen.5 = 1 Then set Portc.1 Else reset Portc.1
If Zeichen.6 = 1 Then set Portc.2 Else reset Portc.2
If Zeichen.7 = 1 Then set Portc.3 Else reset Portc.3
'Waitms 1
set EN
Waitus 123
reset EN
' Waitms 1
' Niederwertiges Nibble setzen
If Zeichen.0 = 1 Then Portc.0 = 1 Else Portc.0 = 0
If Zeichen.1 = 1 Then Portc.1 = 1 Else Portc.1 = 0
If Zeichen.2 = 1 Then Portc.2 = 1 Else Portc.2 = 0
If Zeichen.3 = 1 Then Portc.3 = 1 Else Portc.3 = 0
' Waitms 1
set En
Waitus 123
reset EN
end Sub
'----------------
Sub Lcdwritehh(byval Zeichen As Byte)
reset Portb.0
' hihg Nibble
If Zeichen.4 = 1 Then Portc.0 = 1 Else Portc.0 = 0
If Zeichen.5 = 1 Then Portc.1 = 1 Else Portc.1 = 0
If Zeichen.6 = 1 Then Portc.2 = 1 Else Portc.2 = 0
If Zeichen.7 = 1 Then Portc.3 = 1 Else Portc.3 = 0
' Niederwertiges Nibble übertragen
'Waitms 1
set En
Waitus 123
reset En
End Sub