#include<pic.h>
int cnt;
int i;
void zero(){
RB0=0;
RB1=0;
RB2=1;
RB3=0;
RB4=1;
RB5=0;
RB6=0;
RB7=0;
}
void one(){
RB0=1;
RB1=1;
RB2=1;
RB3=0;
RB4=1;
RB5=1;
RB6=1;
RB7=0;
}
void two(){
RB0=0;
RB1=0;
RB2=1;
RB3=1;
RB4=0;
RB5=0;
RB6=1;
RB7=0;
}
void three(){
RB0=1;
RB1=0;
RB2=1;
RB3=0;
RB4=0;
RB5=0;
RB6=1;
RB7=0;
}
void four(){
RB0=1;
RB1=1;
RB2=1;
RB3=0;
RB4=0;
RB5=1;
RB6=0;
RB7=0;
}
void five(){
RB0=1;
RB1=0;
RB2=1;
RB3=0;
RB4=0;
RB5=0;
RB6=0;
RB7=1;
}
void six(){
RB0=0;
RB1=0;
RB2=1;
RB3=0;
RB4=0;
RB5=1;
RB6=0;
RB7=1;
}
void seven(){
RB0=1;
RB1=1;
RB2=1;
RB3=0;
RB4=1;
RB5=0;
RB6=0;
RB7=0;
}
void eight(){
RB0=0;
RB1=0;
RB2=1;
RB3=0;
RB4=0;
RB5=0;
RB6=0;
RB7=0;
}
void nine(){
RB0=1;
RB1=1;
RB2=1;
RB3=0;
RB4=0;
RB5=0;
RB6=0;
RB7=0;
}
int Chataring(){
int j,k,l,c=0;
for(j=0;j<200;j++){
for(k=0; k<2000; k++){
for(l=0;l<250;l++){
if(RA0==0){
c++;
}else if(RA0==0 && c>=5){
i++;
return 0;
}else{
c=0;
}
}
}
}
i=0;
while(RA==0){}
return 0;
}
void main(void){
TRISA=0x01;
TRISB=0x00;
PORTA=0x00;
cnt=0;
RA4=1;
while(1){
switch(cnt%10){
case(0):
zero();
break;
case(1):
one();
break;
case(2):
two();
break;
case(3):
three();
break;
case(4):
four();
break;
case(5):
five();
break;
case(6):
six();
break;
case(7):
seven();
break;
case(8):
eight();
break;
case(9):
nine();
break;
}
if(RA0==0){
Chataring();
}
}
}