1 sn aralıklarla girme durumunun farklı algoritmayla çözümü...
---------------------------------------------------------
#include "E:\pic c projeler\Yeni Klasör (2)\main.h"
#byte portc=0x07
#byte portb=6
#use fast_io(c)
#use fast_io(b)
char const keys[]={1,2,3,0,4,5,6,0,7,8,9,0,0xF,0,0xF,0};
unsigned char sifre[4];
int i=0,x;
void main()
{
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
// TODO: USER CODE!!
set_tris_b(0x01);
set_tris_c(0xF0);
portb=0;
portc=0;
for(;; ){
basla:
if(input(pin_b0)){
portc=keys[portc>>4];
sifre=portc&0x0F;
i++;
while(input(pin_b0));
if(i>3)
{
i=0;
}
}
if(sifre[0]==0&&sifre[1]==4&&sifre[2]==6&&sifre[3]==0) //şifre doğruysa
output_high(pin_b1);// b1 pinini high yap
else
{ goto basla;
}
}
}