salt a tous,
g besoin d'aide pour mon projet svp. il s'agit de realiser un montage avec lcd et clavier 4x4. dans l'ecran je dois ecrire des valeur qui doivent etre utilisier apres validation. j'arive a ecrire les valeures mais je bloque quand il s'agit de faire 'incrementation de la valeur. regardez mon programme et dites moi svp ce que je dois faire...
Code:#define MASK 0xF0 #define Enter 11 unsigned char getkeypad() { unsigned int i, Key = 0; PORTB = 0x01; while((PORTB & MASK) == 0) { PORTB = (PORTB << 1); Key++; if(Key == 4) { PORTB = 0x01; Key = 0; } } Delay_ms(20); for(i = 0x10; i !=0; i <<=1) { if((PORTB & i) != 0)break; Key = Key + 4; } PORTB=0x0F; while((PORTB & MASK) != 0); Delay_ms(20); return (Key); } sbit LCD_RS at RC2_bit; sbit LCD_EN at RC3_bit; sbit LCD_D4 at RC4_bit; sbit LCD_D5 at RC5_bit; sbit LCD_D6 at RC6_bit; sbit LCD_D7 at RC7_bit; sbit LCD_RS_Direction at TRISC2_bit; sbit LCD_EN_Direction at TRISC3_bit; sbit LCD_D4_Direction at TRISC4_bit; sbit LCD_D5_Direction at TRISC5_bit; sbit LCD_D6_Direction at TRISC6_bit; sbit LCD_D7_Direction at TRISC7_bit; int KM= 10000 ; char *Kilo[10]; int Hr= 23; char *heu[10]; int Minute=59; char *Minu[10]; int Seconde=55; char *seco[10]; int tiers; char *tier[10]; int da=29; int totalda; char *days[10]; int m=2; char *mois[10]; int y=2016; char *years[10]; bit oldstate; void main() { unsigned char MyKey, r, km, m1, y, h, m2, s, jr, i,j,lcd[5],op[12]; unsigned long rame, Kilo, mois, jour, year, heure, min, sec; TRISD0_bit = 1; intcon=0x6; TRISC = 0; TRISB = 0xF0; oldstate = 0; Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); //Lcd_Cmd(_LCD_CURSOR_OFF); Lcd_Out(2,2,"B I E N V E N U"); Lcd_Out(3,2,"MONSIEUR BAHOLE"); Delay_ms(2000); Lcd_Cmd(_LCD_CLEAR); for(;;) { MyKey = 0; rame = 0; r=0; kilo = 0; jour=0; mois=0; year=0; heure=0; min=0; sec=0; Lcd_Out(1,1,"N°rame: "); while(1) { MyKey = getkeypad(); if(MyKey == Enter)break; MyKey++; if(MyKey == 10)MyKey = 0; Lcd_Chr_CP( MyKey + '0'); rame = 10*rame + MyKey; } Lcd_Out(2,1,"KM: "); while(1) { MyKey = getkeypad(); if(MyKey == Enter)break; mykey++; if(MyKey == 10)MyKey = 0; Lcd_Chr_CP( MyKey +'0'); kilo = 10*kilo + MyKey; } Lcd_Out(3,1,"JR: "); while(1) { MyKey = getkeypad(); if(MyKey == Enter)break; mykey++; if(MyKey == 10)MyKey = 0; Lcd_Chr_CP( MyKey +'0'); jour = 10*jour + MyKey; } Lcd_Chr_CP('/'); while(1) { MyKey = getkeypad(); if(MyKey == Enter)break; mykey++; if(MyKey == 10)MyKey = 0; Lcd_Chr_CP( MyKey +'0'); mois = 10*mois + MyKey; } Lcd_Chr_CP('/'); while(1) { MyKey = getkeypad(); if(MyKey == Enter)break; mykey++; if(MyKey == 10)MyKey = 0; Lcd_Chr_CP( MyKey +'0'); year = 10*year + MyKey; } Lcd_Out(4,1,"HR: "); while(1) { MyKey = getkeypad(); if(MyKey == Enter)break; mykey++; if(MyKey == 10)MyKey = 0; Lcd_Chr_CP( MyKey +'0'); heure = 10*heure + MyKey; } Lcd_Chr_CP(':'); while(1) { MyKey = getkeypad(); if(MyKey == Enter)break; mykey++; if(MyKey == 10)MyKey = 0; Lcd_Chr_CP( MyKey +'0'); min = 10*min + MyKey; } Lcd_Chr_CP(':'); longtostr(sec,op); j=0; for(i=0;i<=11;i++) { if(op[i] != ' ') // Si un blanc { lcd[j]=op[i]; j++; } } Lcd_Out_CP(lcd); // Afficher le résultat //Delay_ms(5000); // Temporisation de 5 secondes //Lcd_Cmd(_LCD_CLEAR); sec++; delay_ms(1000); if (sec>59) { sec=0; min++; } } }
g vraiment besoin de votre aide SVP
-----