Arkadaşlar merhaba, encoderli potu rb0 kesmesiyle okutuyorum, kesmesiz okutmayı başaramadım bu nedenle menu kısmında sorun yaşıyorum..
programım switch case döngüsünden bir türlü çıkmıyor, "goto basla" komutu görev yapmıyor, yardımcı olabilir misiniz?
menu kısmına giriş için
while(1){
if (input(pin_a0)==1)
{
switch(menu)
{...
}
}
}
komutunu ekledim fakat input
gnd olmasına rağmen yine switch döngüsüne giriyor bir süre sonra program takılıyor..
menuye giriş çıkışları nasıl yapabilirim yardımcı olur musunuz?
#include <16f877a.h>
#use delay(clock=4M)
#fuses HS, NOWDT, NOPROTECT, NOBROWNOUT, NOPUT, NOLVP,NODEBUG,NOWRT,NOCPD
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7)
#use fast_io(B)
#use fast_io(A)
#include <lcd.c>
long encoder=0,yon;
int menu=0;
#int_ext
void ext_kesmesi()
{
if (input(pin_b1)==0)
{
yon=1;
encoder++;
menu++;
if(menu>=4) menu=4;
}
if (input(pin_b1)==1)
{
yon=0;
encoder--;
menu--;
if(menu<=1) menu=1;
}
}
void main()
{
lcd_init();
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_ccp1(CCP_OFF);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
ext_int_edge(L_TO_H);
set_tris_b(0b00000011);
set_tris_a(0b00000001);
basla:
lcd_gotoxy(1,1);
printf(lcd_putc," <<MENU>> ");
lcd_gotoxy(1,2);
printf(lcd_putc,"<<geri");
lcd_gotoxy(10,2);
printf(lcd_putc,"ileri>>");
while(1)
{
switch(menu)
{
case 1: printf(lcd_putc,"\f Temperature ");lcd_gotoxy(15,2);printf(lcd_putc,">>");delay_ms(300);
goto basla;
break;
case 2: printf(lcd_putc,"\f Timer ");lcd_gotoxy(1,2);printf(lcd_putc,"<<");lcd_gotoxy(15,2);printf(lcd_putc,">>");delay_ms(300);
goto basla;
break;
case 3: printf(lcd_putc,"\f Speed ");lcd_gotoxy(1,2);printf(lcd_putc,"<<");lcd_gotoxy(15,2);printf(lcd_putc,">>");delay_ms(300);
goto basla;
break;
case 4: printf(lcd_putc,"\f Start Delay ");lcd_gotoxy(1,2);printf(lcd_putc,"<<");delay_ms(300);
goto basla;
break;
}
}