horloge numérique

Telechargé par You Nes
// LCD module connections
sbit LCD_RS at RC4_bit;
sbit LCD_EN at RC5_bit;
sbit LCD_D4 at RC0_bit;
sbit LCD_D5 at RC1_bit;
sbit LCD_D6 at RC2_bit;
sbit LCD_D7 at RC3_bit;
sbit LCD_RS_Direction at TRISC4_bit;
sbit LCD_EN_Direction at TRISC5_bit;
sbit LCD_D4_Direction at TRISC0_bit;
sbit LCD_D5_Direction at TRISC1_bit;
sbit LCD_D6_Direction at TRISC2_bit;
sbit LCD_D7_Direction at TRISC3_bit;
// End LCD module connections
char s1;s2;m1;m2;h1;h2;j;pp;cnt;
void interrupt()
{
if(intcon.T0IF==1)
{
cnt++; intcon.T0IF=0;
if(cnt==39) {s1++;cnt=0;}
TMR0=156;
}
}
void main()
{
TRISB=0xff;
INTCON=0XA0;
OPTION_REG=0x07;
s1=s2=m1=m2=h1=h2=48;
pp=58; cnt=0;
j=1;
TMR0=156;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
lcd_chr(2,12,s1);lcd_chr(2,11,s2);lcd_chr(2,10,pp);
lcd_chr(2,9,m1);lcd_chr(2,8,m2);lcd_chr(2,7,pp);
lcd_chr(2,6,h1);lcd_chr(2,5,h2);
for(;;)
{
if(s1==58) {s1=48;s2++;}
if(s2==54) {s1=48;s2=48;m1++;}
if(m1==58) {s1=48;s2=48;m1=48;m2++;}
if(m2==54) {s1=48;s2=48;m1=48;m2=48;h1++;}
if(h1==58) {s1=48;s2=48;m1=48;m2=48;h1=48;h2++;}
if(h2==50 && h1==52) {s1=48;s2=48;m1=48;m2=48;h1=48;h2=48;j++;}
lcd_chr(2,12,s1);lcd_chr(2,11,s2);lcd_chr(2,10,pp);
lcd_chr(2,9,m1);lcd_chr(2,8,m2);lcd_chr(2,7,pp);
lcd_chr(2,6,h1);lcd_chr(2,5,h2);
if(j==1) lcd_out(1,6,"DIMANCHE");
if(j==2) lcd_out(1,6,"LUNDI ");
if(j==3) lcd_out(1,6,"MARDI ");
if(j==4) lcd_out(1,6,"MERCREDI");
if(j==5) lcd_out(1,6,"JEUDI ");
if(j==6) lcd_out(1,6,"VENDREDI");
if(j==7) lcd_out(1,6,"SAMEDI ");
if(j==8) j=1;
}
}
1 / 2 100%

horloge numérique

Telechargé par You Nes
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !