short int ROW_HIGH()
{
if(input (ROW0) || input (ROW1) || input (ROW2) || input (ROW3))
return (1);
else
{
return (0);
}
}
char kbd_getc()
{
static byte kbd_call_count;
static short int kbd_down;
static char last_key;
static byte col;
byte kchar;
byte row;
kchar='\0';
if(++kbd_call_count>KBD_DEBOUNCE_FACTOR)
{
switch (col)
{
case 0:
output_high(col0);
output_low(col1);
output_low(col2);
output_low(col3);
break;
case 1:
output_low(col0);
output_high(col1);
output_low(col2);
output_low(col3);
break;
case 2:
output_low(col0);
output_low(col1);
output_high(col2);
output_low(col3);
break;
case 3:
output_low(col0);
output_low(col1);
output_low(col2);
output_high(col3);
break;
}
if(kbd_down)
{
if(!ROW_HIGH())
{
kbd_down=false;
kchar=last_key;
last_key='\0';
}
}
else
{
if(ROW_HIGH())
{
if(input (row0))
row=0;
else if(input (row1))
row=1;
else if(input (row2))
row=2;
else if(input (row3))
row=3;
last_key = KEYS[row][col];
kbd_down = true;
}
else
{
++col;
if(col==4)
col=0;
}
}
kbd_call_count=0;
}
return(kchar);
}
int8 HEXtoDEC()
{
int8 result;
char *ptr;
result=strtol(str,&ptr,16);
return(result);
}
void main()
{
while(1)
{
//******************TUŞ KİLİDİ İLE GİRİŞ*********************
char k=0;
k=kbd_getc();
if(k!=0)
{
if(cnt<6)
{
string[cnt] = k;
printf(lcd_putc,"%c",string[cnt]);
cnt++;
}
if(cnt==6)
{
lcd_gotoxy(1,1);
printf(lcd_putc,"Cevir ve Gonder");
while(!input(CONVERT));
printf(lcd_putc,"\f");
lcd_gotoxy(1,1);
printf(lcd_putc,"Tekrar Basla");
degisken[0] = string[0];
degisken[1] = string[1];
str[0] = degisken[0];
str[1] = degisken[1];
iservo= HEXtoDEC();
// DEĞERLER KESİNLİKLE "0" OLMAYACAK
// DEĞERLER LCD EKRANDA GÖSTERİLİYOR
lcd_gotoxy(1,2);
printf(lcd_putc,"R%u", iservo);
delay_ms(500);
// DEĞERLER LCD EKRANDA GÖSTERİLİYOR
// ve son nokta :)))
if(iservo==0){iservo=1;} // DEĞER 0 ve 1 OLMAYACAK
servo_duty = iservo;
while(!input(CONVERT));
cnt = 0;
}
}