'============================================ '= TestLCD mit BASCOM-Routinen = '= Abfrage eines Tasters an = '= Port D - Bit 3 = '============================================ ' Einige LCD-Anweisungen ' Lcd A 'disply variable ' Lcd "Hello world." 'display this at the selectet line ' Lowerline 'select the lower line ' Shiftlcd Right 'shift the text to the right ' Shiftlcd Left 'shift the text to the left ' Locate 2 , 1 'set cursor position ' Shiftcursor Right 'shift the cursor ' Home Upper 'select line 1 and return home ' Cursor Off Noblink 'hide cursor ' Cursor On Blink 'show cursor ' Display Off 'turn display off ' Display On 'turn display on '_______________________________________________________________________________ $regfile = "m8def.dat" 'für Mega8 $crystal = 8000000 'Quarz 8 MHz Dim S As String * 16 , 'String für LCD-Ausgabe Dim Uref As Single , U As Single , U_adc As Word , Taste As Bit ' Nachfolgende Portzuweisung für BASCOM LCD-Routinen ' Einstellungen können bei den Compiler/LCD-Optionen festgelegt werden. ' Die hier angegebenen Einstellungen überschreiben die vorhandenen Compilereinstellungen ' ' Die Anschlüsse DB4 - DB7 am LCD sind in diesem Fall PortB: Bit0 bis Bit3, E und Rs siehe Config Lcdpin ' Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3 , E = Portb.5 , Rs = Portb.4 Config Lcd = 16 * 4 'muss sein für BASCOM-Ausgaben mit 16 Zeichen und 2 Zeilen Config Lcdbus = 4 Cls Config Portd.3 = Input 'PortD.3 als Eingabeport für eine 'Taste gegen GND festlegen Portd.3 = 1 'PullUp-Widerstand aktivieren Do Locate 1 , 1 Waitms 100 If Pind.3 = 1 Then Lcd "Taste gedrückt" Else Lcd "Taste nicht gedrückt" End If Loop End