'---------------------------------------------------------- ' Programm initialisieren '---------------------------------------------------------- $regfile = "M32def.DAT" 'use the ATMEGA32 file $crystal = 12000000 ' Taktfrequenz: 12.000 MHz '------------------------------------------------------------------------------- ' LCD '------------------------------------------------------------------------------- Dim Disp As Byte Dim Ausg As Byte Dim _portc As Byte Config Lcdpin = Pin , Db4 = Portc.3 , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0 , E = Portc.4 , Rs = Portc.5 Config Lcd = 20 * 4 'Initlcd EA DIP204-4NLED Disp = &B01000010 ' 0100|0010| 4 Bit-Datenlänge, extension Bit RE=1 Gosub Lcdcontrol Disp = &B00001001 ' 0000|1001| 4 Zeilen Modus Gosub Lcdcontrol Disp = &B01000000 ' 0100|0000| 4 Bit-Datenlänge, extension Bit RE=0 Gosub Lcdcontrol 'Disp = &B00000110 ' 0000|0110| Entry Mode Set Cursor Auto-Increment 'Gosub Lcdcontrol 'Disp = &B00001000 ' 0000|1000| Display ein Cursor aus Blinken aus 'Gosub Lcdcontrol ' Pinbelegung Sepp: ' PC4 | PC5 | PC3 PC2 PC1 PC0 | PC3 PC2 PC1 PC0 ' E | RS | D4 D5 D6 D7 | D0 D1 D2 D3 ' 0 1 0 0 | 0 0 1 0 | 4 Bit-Datenlänge, extension Bit RE=1 ' 0 0 0 0 | 1 0 0 1 | 4 Zeilen Modus ' 0 1 0 0 | 0 0 0 0 | 4 Bit-Datenlänge, extension Bit RE=0 ' 0 0 0 0 | 0 1 1 0 | Entry Mode Set Cursor Auto-Increment ' 0 0 0 0 | 0 0 1 1 | Display ein, Cursor aus, Blinken aus ' 0 0 0 0 | 1 0 0 0 | LCD Inhalt löschen und Cursor auf Home Cls Cursor Off Lcd "Hello world" Locate 3 , 1 Lcd "Test von DL7SEP " Locate 2 , 1 Lcd "Zeile 3 " Locate 4 , 1 Lcd "Zeile vier " ' usw.... '------------------------------------------------------------------------------- ' Hauptprogramm '------------------------------------------------------------------------------- Do Loop End '------------------------------------------------------------------------------- Lcdcontrol: Portc.5 = 0 '------------------------------------------------------------------------------- Writelcdbyte: Ausg = Disp Rotate Ausg , Right , 4 Ausg = Ausg And &B00001111 _portc = Portc _portc = _portc And &B11110000 Ausg = Ausg Or _portc Portc = Ausg Gosub Lcdwriteenable Disp = Disp And &B00001111 Disp = Disp Or _portc Portc = Disp Gosub Lcdwriteenable Waitus 50 Return '------------------------------------------------------------------------------- Lcdwriteenable: Portc.4 = 1 nop nop nop Portc.4 = 0 Return '-------------------------------------------------------------------------------