void setHomeCentral(void)
{
    //char header[]  = {"w,1,0,0,100,3,1,"};                 // no title

    //char footer[]  = {"w,5,0,49,100,1,0,"};
    // char window2[] = {"w,2,0,3,60,40,1,Data Webserver"};
    vga_command("r");
    //delay_ms(1000);
    uint8_t posy=0;
    //vga_command(header);       // Create header
    setFeld(1,0,0,100,3,1,"");
    vga_command("f,1");
    vga_puts("Home Central Rueti");


    posy+= 3;
    setFeld(2,0,posy,100,6,1,""); // Heizung
    vga_command("f,2");
    vga_puts("Heizung");

    posy+= 6;
    setFeld(3,0,posy,100,3,1,""); // Werkstatt
    vga_command("f,3");
    vga_puts("Werkstatt");

    posy+= 3;
    setFeld(4,0,posy,100,3,1,""); // WoZi
    vga_command("f,1");
    vga_puts("WoZi");



}
示例#2
0
文件: main.c 项目: chrisforbes/rgos
static void put_status_line( u08 ok __unused, char const * msg )
{
	vga_setcolor( 0x0b ); 
	vga_puts( "* " ); 
	vga_setcolor( 0x0f ); 
	vga_puts( msg );
	vga_put( '\n' );
}
示例#3
0
文件: common.c 项目: 16Bitt/Flat-OS
void panic(char* msg, char* file, unsigned int line){
	vga_puts("\nPANIC: ");
	vga_puts(file);
	vga_puts(" on line ");
	vga_puts_hex(line);

	int i;
	for(;;)
		i++;
}
示例#4
0
文件: common.c 项目: 16Bitt/virtix
void dump_struct(void* structure, size_t bytes){
	char* list = (char*) structure;
	
	vga_puts_hex((uint) structure);
	vga_puts(": ");

	int i;
	for(i = 0; i < bytes; i++){
		vga_putc_hex(list[i]);
		vga_puts(" ");
	}

	vga_puts("\n");
}
示例#5
0
文件: printk.c 项目: acevest/kernel
int printk(const char *fmtstr, ...)
{
    char *args = (char*)(((char*)&fmtstr)+4);
    vsprintf(pkbuf, fmtstr, args);
    vga_puts(printk_screen_nr, pkbuf, 0x2);
    return 0;
}
示例#6
0
文件: common.c 项目: 16Bitt/virtix
void panic(char* msg, char* file, unsigned int line){
	vga_set_fg(RED);
	vga_set_bg(WHITE);
	
	vga_puts("\nPANIC: ");
	vga_puts(file);
	vga_puts(" on line ");
	vga_puts_hex(line);

	vga_puts(" because ");
	vga_puts(msg);

	int i;
	for(;;)
		i++;
}
示例#7
0
文件: fs.c 项目: 16Bitt/virtix
void mnt_initrd(unsigned int ptr){
	unsigned int address = *((unsigned int*) ptr);
	size = *((unsigned int*) address);
	
	unsigned int magic_header = *(unsigned int*)(address + 4);
	unsigned int magic_footer = *(unsigned int*)(address + size - 4);

	ASSERT((magic_footer == FFS_MAGIC) && (magic_header == FFS_MAGIC));

	fs_root = (directory_t*) kmalloc(sizeof(directory_t));
	fs_root->start = address;

	unsigned int num_files = *(unsigned int*)(address + 8);
	fs_root->num_files = num_files;

	file_t** files_list = (file_t**) kmalloc(sizeof(file_t*) * num_files);
	
	int i;
	for(i = 0; i < num_files; i++){
		file_t* new_file = (file_t*) kmalloc(sizeof(file_t));
		files_list[i] = new_file;
		
		new_file->name 		= (char*) (address + 12 + (i * FFS_ENTRY_SIZE));

		vga_puts("CREATING: ");
		vga_puts(new_file->name);
		vga_putc('\t');
		

		new_file->offset 	= *((unsigned int*) (address + 12 + (i * FFS_ENTRY_SIZE) + 128));
		vga_puts("OFFSET: ");
		vga_puts_hex(new_file->offset);
		vga_putc('\t');


		new_file->size		= *((unsigned int*) (address + 12 + (i * FFS_ENTRY_SIZE) + 128 + 4));
		vga_puts("SIZE: ");
		vga_puts_hex(new_file->size);
		vga_putc('\n');

		new_file->data		= (unsigned char*) (address + new_file->offset);
	}

	fs_root->files = files_list;
}
示例#8
0
文件: main.c 项目: nobleman/nobleos
int start(void* mbd, unsigned int magic) //mbd - multiboot structur info
{
    vga_init();
    bda_init(); // bda - bios data area, place where was bios information

    if (magic != 0x2BADB002) //error handling
    {
        vga_puts(" :( Kernel PANIC: ");
        vga_puts("failed to load kernel");
    }

    vga_puts("\nUruchomienie sterownika kernela powiodlo sie! \n");
    vga_puts("Zaladowanie kernela powiodlo sie! \n");

    hlt();

    return 0;
}
示例#9
0
文件: printk.c 项目: acevest/kernel
int printd(const char *fmtstr, ...)
{
    char *pdbuf = (char *)kmalloc(1024, 0);
    char *args = (char*)(((char*)&fmtstr)+4);
    vsprintf(pdbuf, fmtstr, args);
    vga_puts(3, pdbuf, 0x4);
    kfree(pdbuf);
    return 0;
}
示例#10
0
文件: shell.c 项目: t00n/YalOS
void echo(int argc, char** argv)
{
	int len = argc, i;
	for (i = 1; i < len; ++i)
	{
		vga_puts(argv[i]);
		vga_putc(' ');
	}
	vga_putnl();
}
示例#11
0
文件: main.c 项目: chrisforbes/rgos
void kmain( struct multiboot_info * info )
{
	page_init();	/* we start up with a hacked segment base, so */
	gdt_init();		/* get paging enabled and a real GDT installed first. */
	
	vga_clear();
	
	put_status_line( 1, "Paging enabled." );
	put_status_line( 1, "Starting Physical Memory Allocator..." );
	phys_alloc_init( info );
	
	put_status_line( 1, "Starting Kernel Heap Allocator..." );
	kmalloc_init();	
	page_init_finish();
	
	/* install other default handlers */
	
	timer_init( 50 );
	
	/* test the heap allocator */
	int * foo = kmalloc( 240 );
	vga_puts( "Allocation test: " );
	vga_put_hex( (u32) foo );
	vga_puts( "\n" );
	
	*foo = 42;	/* shouldn't die */
	
	put_status_line( 1, "Scanning PCI buses..." );
	pci_enum_devices();
	
	/* finished initializing, so turn on the interrupts */
	enable_interrupts();
	
//	asm volatile( "int $0x3" );
	
	for(;;)
		halt();
}
示例#12
0
文件: fat16.c 项目: 16Bitt/virtix
void disp_fat_dir(){
	vga_puts("init_fat(): FAT volume contains the following files\n");
	
	int count = 0;

	int i;
	for(i = 0; i < fat_header.dir_size; i++){
		if(fat_dir[i].name[0] != 0){
			vga_fmt("\t* %s\t%d bytes\tfirst cluster %d\n", fat_dir[i].name, fat_dir[i].bytes, fat_dir[i].cluster_low);
			count++;
		}
	}

	vga_fmt("\nFAT directory contains %d files.\n", count);
}
示例#13
0
文件: vfs.c 项目: 16Bitt/virtix
fs_node_t* vfs_mkdir(fs_node_t* node, char* name){
	fs_node_t* dir = vfs_get_dir(node, name);
	if(dir == NULL){
		vga_puts("vfs_mkdir(): invalid path\n");
		return NULL;
	}
	
	fs_node_t* file = mk_empty_dnode();
	strmov(file->name, basename(name));

	file->link = dir->holds;
	dir->holds = file;

	return file;
}
示例#14
0
文件: vfs.c 项目: 16Bitt/virtix
void vfs_ls(char* path){
	fs_node_t* dir = fs_path(df_root, path);
	if(dir == NULL){
		vga_puts("vfs_ls(): invalid path\n");
		return;
	}

	fs_node_t* link = dir->holds;
	
	vga_puts("directory listing for ");
	vga_puts(path);
	vga_puts("\n");
	while(link != NULL){
		vga_puts(link->name);
		if(link->flags == FS_DIRECTORY)
			vga_puts("/");
		vga_puts("\n");
		link = link->link;
	}
}
示例#15
0
文件: panic.c 项目: chrisforbes/rgos
void panic( char const * file, int line, char const * failure, struct regs * r )
{
	vga_puts( "KERNEL PANIC at " );
	vga_puts( file );
	vga_puts( ":" );
	vga_put_dec( line );
	vga_puts( "\n\t  " );
	vga_puts( failure );
	vga_puts( "\n" );
	
	if (r)
	{	/* dump the reg state: */
		put_reg( " ds", r->ds );
		put_reg( "edi", r->edi );
		put_reg( "esi", r->esi );
		put_reg( "ebp", r->ebp );
		vga_put( '\n' );
		put_reg( "esp", r->esp );
		put_reg( "ebx", r->ebx );
		put_reg( "edx", r->edx );
		put_reg( "ecx", r->ecx );
		vga_put( '\n' );
		put_reg( "eax", r->eax );
		put_reg( "int_no", r->int_no );
		put_reg( "err_code", r->err_code );
		put_reg( "eip", r->eip );
		vga_put( '\n' );
		put_reg( "cs", r->cs );
		put_reg( "eflags", r->eflags );
		put_reg( "user_esp", r->user_esp );
		put_reg( "user_ss", r->user_ss );
	}
	
	for(;;)
	{
		disable_interrupts();
		halt();
	}
}
示例#16
0
文件: panic.c 项目: chrisforbes/rgos
static void put_reg( char const * name, u32 val )
{
	vga_puts( name ); vga_put( '=' );
	vga_put_hex( val ); vga_put( ' ' );
}
示例#17
0
文件: fat16.c 项目: 16Bitt/virtix
void disp_bpb(){
	vga_puts("init_fat(): read FAT12/16 volume\n");
	
	vga_puts("\t* with OEM identifier '");
	int i;
	for(i = 0; i < 8; i++)
		vga_putc(fat_header.oem_ident[i]);
	
	vga_puts("'\n\t* with ");
	vga_puts_hex(fat_header.sectors_per_cluster);
	vga_puts(" sectors per cluster\n");

	vga_puts("\t* with ");
	vga_puts_hex(fat_header.number_fats);
	vga_puts(" FATs\n");

	vga_puts("\t* with ");
	vga_puts_hex(fat_header.number_reserved);
	vga_puts(" reserved sectors\n");
	
	vga_puts("\t* with ");
	vga_puts_hex(fat_header.media_type);
	vga_puts(" media type\n");
	
	vga_puts("\t* with ");
	vga_puts_hex(fat_header.number_hidden);
	vga_puts(" hidden sectors\n");

	vga_puts("\t* with ");
	vga_puts_hex(fat_header.dir_size);
	vga_puts(" root entries\n");
	
	vga_fmt("\t* with %d sectors per fat\n", fat_header.sectors_per_fat);
}
示例#18
0
文件: timer.c 项目: 16Bitt/Flat-OS
static void timer_callback(registers_t regs){
	tick++;
	vga_puts("TICK:");
	vga_puts_hex(tick);
	vga_putc('\n');
}
示例#19
0
文件: deepfat.c 项目: 16Bitt/virtix
void df_close(fs_node_t* node){
	vga_puts("WARN: df_close() is dummy stub\n");
	return;
}
int main (void)
{
    /* INITIALIZE */
//	LCD_DDR |=(1<<LCD_RSDS_PIN);
//	LCD_DDR |=(1<<LCD_ENABLE_PIN);
//	LCD_DDR |=(1<<LCD_CLOCK_PIN);



    slaveinit();

    lcd_initialize(LCD_FUNCTION_8x2, LCD_CMD_ENTRY_INC, LCD_CMD_ON);
    lcd_puts("Guten Tag\0");
    delay_ms(1000);

    //lcd_cls();
    //lcd_puts("READY\0");
    delay_ms(1000);
    // DS1820 init-stuff begin

    uart_init();

    InitSPI_Slave();

    uint8_t linecounter=0;

    uint8_t SPI_Call_count0=0;
    lcd_cls();
    lcd_puts("UART\0");

#pragma mark while
    // OSZIA_HI;
    //char teststring[] = {"p,10,12"};


    initADC(TASTATURKANAL);

//  vga_start();

    setHomeCentral();
    vga_command("f,1");
    startcounter = 0;
    linecounter=0;
    uint8_t lastrand=rand();
    //srand(1);
    sei();
    uint8_t incounter=0;
    //uint8_t x=0;
    while (1)
    {
        loopCount0 ++;

        if (loopCount0 >=0x00FF)
        {
            //readSR();
            loopCount1++;

            if ((loopCount1 >0x01FF) )//&& (!(Programmstatus & (1<<MANUELL))))
            {
                LOOPLED_PORT ^= (1<<LOOPLED_PIN);
                if ((uartstatus & (1<< SUCCESS_BIT))&& (SPI_CONTROL_PORTPIN & (1<<SPI_CONTROL_CS_HC)))
                {
                    incounter++;
                    lcd_gotoxy(0,0);
                    lcd_puts("OK\0");
                    //lcd_puthex(in_startdaten);
                    lcd_putc(' ');
                    lcd_putint(incounter);
                    cli();
                    delay_ms(100);
                    //vga_command("f,2");
                    //vga_putch('*');
                    //putint(254);


                    uartstatus &= ~(1<< SUCCESS_BIT);


                    sei();

                }
                else
                {
                    //lcd_gotoxy(0,0);
                    //lcd_puts("  \0");

                }
                {
                    //lcd_gotoxy(15,3);
                    //lcd_putint(BitCounter);
                    /*
                    loopCount2++;
                    vga_command("f,2");
                    //puts("HomeCentral ");
                    vga_puts("Tastenwert ");
                    putint(Tastenwert);
                    vga_putch(' ');
                    newline();
                     */
                    /*
                    if (loopCount2 > 2)
                    {
                      newline();
                      linecounter++;
                      if (linecounter>50)
                      {
                         linecounter=0;
                         vga_command("e");
                      }
                      if (linecounter %3==0)
                      {
                         //linecounter =0;
                         linecounter+=1;
                         gotoxy(8,linecounter);
                         vga_command("f,2");
                         vga_puts("Stop");
                         putint_right(linecounter);
                         vga_putch(' ');
                         putint(Tastenwert);
                         //newline();
                         vga_command("f,1");
                         vga_command("e");
                         vga_puts("Daten");
                         putint_right(linecounter);
                         vga_command("f,2");
                         //vga_command("e");

                         gotoxy(0,linecounter);
                         vga_command("f,2");
                         newline();
                      }
                      loopCount2=0;
                    }
                    */
                    loopCount1=0;

                } // if startcounter

            }

            loopCount0 =0;
            //

            goto NEXT;
            {
                cli();

                {
                    Tastenwert=(uint8_t)(readKanal(TASTATURKANAL)>>2);

                    //lcd_gotoxy(12,1);
                    //lcd_puts("TW:\0");
                    //lcd_putint(Tastenwert);
                    if (Tastenwert>5) // ca Minimalwert der Matrix
                    {
                        tastaturstatus |= (1<<1);
                        //			wdt_reset();
                        /*
                         0: Wochenplaninit
                         1: IOW 8* 2 Bytes auf Bus laden
                         2: Menu der aktuellen Ebene nach oben
                         3: IOW 2 Bytes vom Bus in Reg laden
                         4: Auf aktueller Ebene nach rechts (Heizung: Vortag lesen und anzeigen)
                         5: Ebene tiefer
                         6: Auf aktueller Ebene nach links (Heizung: Folgetag lesen und anzeigen)
                         7:
                         8: Menu der aktuellen Ebene nach unten
                         9: DCF77 lesen

                         12: Ebene höher
                         */
                        TastaturCount++;
                        if (tastaturstatus & (1<<1))
                        {

                        }

                        if (TastaturCount>=80)	//	Prellen
                        {
                            tastaturstatus &= ~(1<<1);
                            Taste=Tastenwahl(Tastenwert);
                            lcd_gotoxy(0,1);
                            lcd_puts("T:\0");
                            //
                            lcd_putc(' ');
                            lcd_putint(Tastenwert);
                            lcd_putc(' ');
                            if (Taste >=0)
                            {
                                lcd_putint2(Taste);
                            }
                            else
                            {
                                lcd_putc('*');
                            }

                            //lcd_gotoxy(14,1);


                            //lcd_putint(linecounter);
                            //lcd_putc(' ');
                            //lcd_putint((uint8_t)rand()%40);

                            switch (Taste)
                            {
                            case 1:
                            {
                                vga_command("f,2");
                                gotoxy(0,2);
                                vga_command("f,2");
                                vga_puts("Brenner: ");
                            }
                            break;
                            case 2:
                            {
                                vga_command("f,3");
                                gotoxy(cursorx,cursory);
                                vga_command("f,3");
                                vga_putch(' ');

                                cursory--;
                                gotoxy(cursorx,cursory);
                                vga_command("f,3");
                                vga_putch('>');

                            }
                            break;
                            case 3:
                            {

                            } break;
                            case 4:
                            {
                                if (menuebene)
                                {
                                    menuebene--;
                                    if (cursorx>10)
                                    {
                                        vga_command("f,3");
                                        gotoxy(cursorx,cursory);
                                        vga_command("f,3");
                                        vga_putch(' ');
                                        cursorx-=10;
                                        gotoxy(cursorx,cursory);
                                        vga_command("f,3");
                                        vga_putch('>');
                                    }
                                }

                            }
                            break;
                            case 5:
                            {
                                vga_command("f,3");
                                gotoxy(cursorx,cursory);
                                vga_command("f,3");
                                vga_putch('>');

                            }
                            break;
                            case 6:
                            {
                                if (menuebene<MAXMENUEBENE)
                                {
                                    menuebene++;
                                    if (cursorx<40)
                                    {
                                        vga_command("f,3");
                                        gotoxy(cursorx,cursory);
                                        vga_command("f,3");
                                        vga_putch(' ');

                                        cursorx+=10;
                                        gotoxy(cursorx,cursory);
                                        vga_command("f,3");
                                        vga_putch('>');
                                    }
                                }
                            }
                            break;
                            case 7:
                            {

                                setFeld(3,70,3,30,32,1,"");
                                vga_command("f,3");
                                //vga_putch('x');
                                //lcd_putc('+');

                            }
                            break;
                            case 8:
                            {
                                vga_command("f,3");
                                gotoxy(cursorx,cursory);
                                vga_command("f,3");
                                vga_putch(' ');

                                cursory++;
                                gotoxy(cursorx,cursory);
                                vga_command("f,3");
                                vga_putch('>');

                            }
                            break;
                            case 9:
                            {

                            } break;
                            case 10:
                            {
                                setHomeCentral();
                            }
                            break;
                            case 12:
                            {
                                vga_command("f,3");
                                vga_command("e");
                                gotoxy(cursorx,cursory);
                                vga_command("f,3");
                                vga_putch(' ');
                                cursorx = CURSORX;
                                cursory = CURSORY;
                                gotoxy(CURSORX+1,CURSORY);
                                vga_command("f,3");
                                vga_puts("Alpha");
                                gotoxy(CURSORX+1,CURSORY+1);
                                vga_command("f,3");
                                vga_puts("Beta");
                                gotoxy(CURSORX+1,CURSORY+2);
                                vga_command("f,3");
                                vga_puts("Gamma");
                                gotoxy(CURSORX+1,CURSORY+3);
                                vga_command("f,3");
                                vga_puts("Delta");
                                gotoxy(cursorx,cursory);
                                vga_command("f,3");
                                vga_putch('>');

                            }
                            break;


                            } // switch Taste



                            lastrand = rand();
                            vga_command("f,2");
                            //vga_putch(' ');

                            //gotoxy(4,linecounter);
                            //lcd_gotoxy(16,1);
                            //lcd_putint(erg);
                            /*
                            putint(linecounter);
                            vga_putch(' ');
                            putint_right(Tastenwert);
                            vga_putch(' ');
                            putint_right(Taste);
                            */
                            //newline();
                            linecounter++;
                            TastaturCount=0;

                        }

                    } // if Tastenwert

                }

            }
NEXT:
            //x=0;
            sei();
            //
        }

        /* *** SPI begin **************************************************************/

        //lcd_gotoxy(19,0);
        //lcd_putc('-');

        // ***********************
        //goto ENDSPI;
        if (SPI_CONTROL_PORTPIN & (1<< SPI_CONTROL_CS_HC)) // PIN ist Hi, SPI ist Passiv
        {
            // lcd_gotoxy(19,1);
            //  lcd_putc('*');

            // ***********************
            /*
             Eine Uebertragung hat stattgefunden.
             (Die out-Daten sind auf dem Webserver.)
             Die in-Daten vom Webserver sind geladen.
             Sie muessen noch je nach in_startdaten ausgewertet werden.
             */

            // ***********************
//			SPI_CONTROL_PORT |= (1<<SPI_CONTROL_MISO); // MISO ist HI in Pausen

#pragma mark PASSIVE

            if (spistatus &(1<<ACTIVE_BIT)) // Slave ist neu passiv geworden. Aufraeumen, Daten uebernehmen
            {

                wdt_reset();
                SPI_Call_count0++;
                // Eingang von Interrupt-Routine, Daten von Webserver
                //lcd_gotoxy(19,0);
                //lcd_putc(' ');

                // in lcd verschoben
                lcd_clr_line(2);
                lcd_gotoxy(0,2);

                // Eingang anzeigen
                lcd_puts("iW \0");
                lcd_puthex(in_startdaten);
                lcd_putc(' ');
                lcd_puthex(in_hbdaten);
                lcd_puthex(in_lbdaten);
                lcd_putc(' ');
                uint8_t j=0;
                for (j=0; j<2; j++)
                {
                    //lcd_putc(' ');
                    lcd_puthex(inbuffer[j]);
                    //lcd_putc(inbuffer[j]);
                }
                OutCounter++;

                // Uebertragung pruefen

                //lcd_gotoxy(6,0);
                //lcd_puts("bc:\0");
                //lcd_puthex(ByteCounter);

                //lcd_gotoxy(0,0);
                //lcd_puts("      \0");


                lcd_gotoxy(19,0);
                lcd_putc(' ');

                if (ByteCounter == SPI_BUFSIZE-1) // Uebertragung war vollstaendig
                {
                    if (out_startdaten + in_enddaten==0xFF)
                    {
                        lcd_gotoxy(19,2);
                        lcd_putc('+');
                        spistatus |= (1<<SUCCESS_BIT); // Bit fuer vollstaendige und korrekte  Uebertragung setzen
                        lcd_gotoxy(19,0);
                        lcd_putc(' ');
                        //lcd_clr_line(3);
                        //lcd_gotoxy(0,1);
                        //lcd_puthex(loopCounterSPI++);
                        //lcd_puts("OK \0");

                        //lcd_puthex(out_startdaten + in_enddaten);
                        //					if (out_startdaten==0xB1)
                        {
                            SendOKCounter++;
                        }
                        spistatus |= (1<<SPI_SHIFT_IN_OK_BIT);
                    }

                    else
                    {
                        spistatus &= ~(1<<SUCCESS_BIT); // Uebertragung fehlerhaft, Bit loeschen
                        lcd_putc('-');
                        lcd_clr_line(1);
                        lcd_gotoxy(0,1);
                        lcd_puts("ER1\0");
                        lcd_putc(' ');
                        lcd_puthex(out_startdaten);
                        lcd_puthex(in_enddaten);
                        lcd_putc(' ');
                        lcd_puthex(out_startdaten + in_enddaten);

                        spistatus &= ~(1<<SPI_SHIFT_IN_OK_BIT);
                        {
                            SendErrCounter++;
                        }
                        //errCounter++;
                    }

                }
                else
                {
                    spistatus &= ~(1<<SUCCESS_BIT); //  Uebertragung unvollstaendig, Bit loeschen
                    lcd_clr_line(0);
                    lcd_gotoxy(0,0);
                    lcd_puts("ER2\0");
                    lcd_putc(' ');
                    lcd_puthex(ByteCounter);
                    //lcd_putc(' ');
                    //lcd_puthex(BitCounter);

                    /*
                    	lcd_putc(' ');
                    lcd_puthex(out_startdaten);
                    lcd_puthex(in_enddaten);
                    lcd_putc(' ');
                    lcd_puthex(out_startdaten + in_enddaten);
                    */
                    //delay_ms(100);
                    //errCounter++;
                    IncompleteCounter++;
                    spistatus &= ~(1<<SPI_SHIFT_IN_OK_BIT);
                }

                //lcd_gotoxy(11, 1);							// Events zahelen
                //lcd_puthex(OutCounter);
                /*
                 lcd_puthex(SendOKCounter);
                 lcd_puthex(SendErrCounter);
                 lcd_puthex(IncompleteCounter);
                 */
                /*
                 lcd_gotoxy(0,0);
                 lcd_putc('i');
                 lcd_puthex(in_startdaten);
                 lcd_puthex(complement);
                 lcd_putc(' ');
                 lcd_putc('a');
                 lcd_puthex(out_startdaten);
                 lcd_puthex(in_enddaten);
                 lcd_putc(' ');
                 lcd_putc('l');
                 lcd_puthex(in_lbdaten);
                 lcd_putc(' ');
                 lcd_putc('h');
                 lcd_puthex(in_hbdaten);
                 out_hbdaten++;
                 out_lbdaten--;

                 lcd_putc(out_startdaten);
                 */
                /*
                 lcd_gotoxy(0,0);
                 lcd_puthex(inbuffer[9]);
                 lcd_puthex(inbuffer[10]);
                 lcd_puthex(inbuffer[11]);
                 lcd_puthex(inbuffer[12]);
                 lcd_puthex(inbuffer[13]);
                 */
                //lcd_gotoxy(13,0);								// SPI - Fehler zaehlen
                //lcd_puts("ERR    \0");
                //lcd_gotoxy(17,0);
                //lcd_puthex(errCounter);

                // Bits im Zusammenhang mit der Uebertragung zuruecksetzen. Wurden in ISR gesetzt
                spistatus &= ~(1<<ACTIVE_BIT);		// Bit 0 loeschen
                spistatus &= ~(1<<STARTDATEN_BIT);	// Bit 1 loeschen
                spistatus &= ~(1<<ENDDATEN_BIT);		// Bit 2 loeschen
                spistatus &= ~(1<<SUCCESS_BIT);		// Bit 3 loeschen
                spistatus &= ~(1<<LB_BIT);				// Bit 4 loeschen
                spistatus &= ~(1<<HB_BIT);				// Bit 5 loeschen

                // aufraeumen
                out_startdaten=0x00;
                out_hbdaten=0;
                out_lbdaten=0;
                for (int i=0; i<SPI_BUFSIZE; i++)
                {
                    outbuffer[i]=0;
                }

                /*
                lcd_gotoxy(0,0);				// Fehler zaehlen
                lcd_puts("IC   \0");
                lcd_gotoxy(2,0);
                lcd_puthex(IncompleteCounter);
                lcd_gotoxy(5,0);
                lcd_puts("TW   \0");
                lcd_gotoxy(7,0);
                lcd_puthex(TWI_errCounter);

                lcd_gotoxy(5,1);
                lcd_puts("SE   \0");
                lcd_gotoxy(7,1);
                lcd_puthex(SendErrCounter);
                */
            } // if Active-Bit

#pragma mark HomeCentral-Tasks

        } // neu Passiv

        // letzte Daten vom Webserver sind in inbuffer und in in_startdaten, in_lbdaten, in_hbdaten


        else						// (IS_CS_HC_ACTIVE)
        {
            if (!(spistatus & (1<<ACTIVE_BIT))) // CS ist neu aktiv geworden, Daten werden gesendet, Active-Bit 0 ist noch nicht gesetzt
            {
                // Aufnahme der Daten vom Webserver vorbereiten

                uint8_t j=0;
                in_startdaten=0;
                in_enddaten=0;
                in_lbdaten=0;
                in_hbdaten=0;
                for (j=0; j<SPI_BUFSIZE; j++)
                {
                    inbuffer[j]=0;
                }

                spistatus |=(1<<ACTIVE_BIT); // Bit 0 setzen: neue Datenserie
                spistatus |=(1<<STARTDATEN_BIT); // Bit 1 setzen: erster Wert ergibt StartDaten

                bitpos=0;
                ByteCounter=0;
                //timer0(); // Ueberwachung der Zeit zwischen zwei Bytes. ISR setzt bitpos und ByteCounter zurueck, loescht Bit 0 in spistatus

                // Anzeige, das  rxdata vorhanden ist
                lcd_gotoxy(19,0);
                lcd_putc('$');
                lcd_gotoxy(19,1);
                lcd_putc(' ');




            }//										if (!(spistatus & (1<<ACTIVE_BIT)))
        }//											(IS_CS_HC_ACTIVE)
ENDSPI:
        /* *** SPI end **************************************************************/

# pragma mark Tasten

        if (!(PINB & (1<<PORTB0))) // Taste 0
        {
            //lcd_gotoxy(12,0);
            //lcd_puts("P0 Down\0");
            //wdt_reset();
            if (! (TastenStatus & (1<<PORTB0))) //Taste 0 war nicht nicht gedrueckt
            {
                TastenStatus |= (1<<PORTB0);
                Tastencount=0;
                //lcd_gotoxy(12,0);
                //lcd_puts("P0\0");
                //lcd_putint(TastenStatus);
                //delay_ms(800);
            }
            else
            {

                Tastencount ++;
                //lcd_gotoxy(7,1);
                //lcd_puts("TC \0");
                //lcd_putint(Tastencount);
                wdt_reset();
                if (Tastencount >= Tastenprellen)
                {
                    //lcd_gotoxy(18,0);
                    //lcd_puts("ON\0");
                    //lcd_putint(TastenStatus);

                    Tastencount=0;
                    TastenStatus &= ~(1<<PORTB0);

                }
            }//else

        }


#pragma mark Tastatur

    } // while