Gast
#441582
Hallo habe meine Folientastatur (http://www1.conrad.de/conrad/layout2/detail.fh?fh_secondid=b2c709930&layout=layout2&fh_host=www1.conrad.de&fh_eds=%c3%9f&do_fh_search=1&fh_session=%2fscripts%2fwgate%2fzcop_b2c%2f~flN0YXRlPTEyNTUxODc1MTQ%3d&fh_location=%2f%2fb2cconrad_de_b2c%2fde_DE&fh_search=folientastatur&fh_refview=search) folgendermaßen angeklemmt: die ersten drei leitungen (Spalten) PORTC0-2 die anderen 4 (Zeilen) an PORTC3-6 Hier das Prog ======================================================================== ==== void main(void) { //////////////////////////////////////// //// Variablendeklarationen //// //////////////////////////////////////// char Zahl; Zahl = 0; //////////////////////////////////////// //// Portbelegungen //// //////////////////////////////////////// DDRA = 0xff; //Port A als Ausgang definieren[Display] DDRC |= 0x07; //Port C0-2 als Ausgang DDRC &= 0x07; //Port C3-6 als Eingang PORTC |= 0x78; //enable pull-ups C3-6 //////////////////////////////////////// //// Displayinitialisierung //// //////////////////////////////////////// //lcd_init(LCD_DISP_ON); lcd_init(LCD_DISP_ON); lcd_clrscr(); lcd_gotoxy(0,1); lcd_puts("Ready"); lcd_gotoxy(0,0); while(1) { //// Spalte_1 //// PORTC |= 0x07; //Port C0-2 auf HIGH setzen PORTC &= 0xFE; //Port C0 LOW setzen [Spalte 1] if( ( PINC & ( 1 << PC3 ) ) == 0 ) //Zeile_1 { Zahl = 1; lcd_puts("1"); } _delay_ms(50); if( ( PINC & ( 1 << PC4 ) ) == 0 ) //Zeile_2 { Zahl = 4; lcd_puts("4"); } _delay_ms(50); if( ( PINC & ( 1 << PC5 ) ) == 0 ) //Zeile_3 { Zahl = 7; lcd_puts("7"); } _delay_ms(50); if( ( PINC & ( 1 << PC6 ) ) == 0 ) //Zeile_4 { Zahl = '*'; lcd_puts("*"); } _delay_ms(50); //// Spalte_2 //// PORTC |= 0x07; //Port C0-2 auf HIGH setzen PORTC &= 0xFD; //Port C1 LOW setzen [Spalte 2] if( ( PINC & ( 1 << PC3 ) ) == 0 ) //Zeile_1 { Zahl = 2; lcd_puts("2"); } _delay_ms(50); if( ( PINC & ( 1 << PC4 ) ) == 0 ) //Zeile_2 { Zahl = 5; lcd_puts("5"); } _delay_ms(50); if( ( PINC & ( 1 << PC5 ) ) == 0 ) //Zeile_3 { Zahl = 8; lcd_puts("8"); } _delay_ms(50); if( ( PINC & ( 1 << PC6 ) ) == 0 ) //Zeile_4 { Zahl = '0'; lcd_puts("0"); } _delay_ms(50); //// Spalte_3 //// PORTC |= 0x07; //Port C0-2 auf HIGH setzen PORTC &= 0xFB; //Port C2 LOW setzen [Spalte 3] if( ( PINC & ( 1 << PC3 ) ) == 0 ) //Zeile_1 { Zahl = 3; lcd_puts("3"); } _delay_ms(50); if( ( PINC & ( 1 << PC4 ) ) == 0 ) //Zeile_2 { Zahl = 6; lcd_puts("6"); } _delay_ms(50); if( ( PINC & ( 1 << PC5 ) ) == 0 ) //Zeile_3 { Zahl = 9; lcd_puts("9"); } _delay_ms(50); if( ( PINC & ( 1 << PC6 ) ) == 0 ) //Zeile_4 { Zahl = '#'; lcd_puts("#"); } _delay_ms(50); } } ======================================================================== = so wenn ich nun mein ATMega16 damit flashe, dann erscheint die ganze zeit nur 2 auf dem Display, als wäre die ganze zeit die taste für 2 gedrückt.... Danke !