#include <16f84a.h>
#fuses nowdt,xt, put
#use delay (clock=4m)
#byte puerto_b=0x06
#use standard_io(b)
#use standard_io(a)
void ext(void);
unsigned int const display[10]={0x7e,0x30,0x6d,0x79,0x33,0x5b,0x5f,0x70,0x7f,0x73};
int x=0,y=0,z=0,o=0;
int flag=0,var=20;
void main(void{
set_tris_b(0x00);
puerto_b=0;
d:
if (input(pin_a0)==1)
ext();
output_high(PIN_A1);
output_high(PIN_A2);
output_high(PIN_A3);
output_low(PIN_A4); //activado...
output_b(display[ x ]); //...1º 7seg
delay_ms(10);
output_high(PIN_A1);
output_high(PIN_A2);
output_low(PIN_A3); //activado...
output_high(PIN_A4);
output_b(display[ y ]); //...2º 7seg
delay_ms(10);
output_high(PIN_A1);
output_low(PIN_A2); //activado...
output_high(PIN_A3);
output_high(PIN_A4);
output_b(display[ z]); //...3º 7seg
delay_ms(10);
output_low(PIN_A1); //activado...
output_high(PIN_A2);
output_high(PIN_A3);
output_high(PIN_A4);
output_b(display[ o ]); //...4º 7seg
delay_ms(10);
goto d;
}
void ext (void) {
if(x>=9){
x=0;
y++;
if(y>9){
y=0;
z++;
if(z>9){
z=0;
o++;
if(o>9)
o=0;
}
}
}
else{
x++; }
}
hise este programa basandome el el de zener y tengo un problema cuando lo cargo al pic arranca y no para nunca de contar y en el proteus anda perfecto alguna idea como seguir ,con el contador, saludos