Declare Function Rn_cmps_himmelsrichtung() As Word ' ---------------RN-Mega128Funk übliche ------------------ $regfile = "m128def.dat" ' Bei Mega 128 " $framesize = 32 $swstack = 32 $hwstack = 32 $crystal = 16000000 'Quarzfrequenz $baud = 19200 'Baudrate für Funkmodul $baud1 = 9600 'Baudrate für MAX Config Scl = Portd.0 'Ports fuer IIC-Bus Config Sda = Portd.1 Config Ping.0 = Output 'Spannung an LCD aktivieren Lcdpower Alias Portg.0 Config Pine.2 = Output Rdy_hostempfangsbereit Alias Porte.2 'Auf Low setzen wenn Empfangsbereit für Datenvom Funkmodul Config Pine.5 = Input Bsy_funkmodulsendebereit Alias Porte.5 'Ist Low wenn Funkmodul frei zum senden Open "com2:" For Binary As #2 'Ausgabe über zweite serielle Schnittstelle (MAX) Sound Portg.2 , 400 , 450 'BEEP bei RN-Mega128Funk Sound Portg.2 , 400 , 250 'BEEP bei RN-Mega128Funk Sound Portg.2 , 400 , 450 'BEEP bei RN-Mega128Funk ' --------------------------------------------------- Config Pinf.6 = Output Lcd_rw Alias Portf.6 Lcd_rw = 0 Lcdpower = 1 Waitms 500 Config Lcd = 20 * 2 Config Lcdpin = Pin , Db4 = Portf.3 , Db5 = Portf.2 , Db6 = Portf.1 , Db7 = Portf.0 , E = Portf.5 , Rs = Portf.7 Config Lcdbus = 4 Initlcd Cls Cursor Off Dim Himmelsrichtung As Word I2cinit Do Himmelsrichtung = Rn_cmps_himmelsrichtung() Cls Lcd Himmelsrichtung Wait 1 Loop End Function Rn_cmps_himmelsrichtung() As Word Local Lob As Byte Local Hib As Byte Local Cmps_slaveid As Byte Local Cmps_slaveid_read As Byte Cmps_slaveid = &HC0 Cmps_slaveid_read = Cmps_slaveid + 1 'Register auswählen I2cstart I2cwbyte Cmps_slaveid I2cwbyte 2 I2cstop I2cstart I2cwbyte Cmps_slaveid_read I2crbyte Hib , Ack I2crbyte Lob , Nack I2cstop Rn_cmps_himmelsrichtung = Makeint(lob , Hib) End Function