cok tesekkur ederım yardımlarınız için.bişiler yazdım ama ufak tefek problemlerim var .
#include "C:\Users\EXPER\Desktop\18F\hesap_makinası.h"
#include <
Lcd.c>
int i,y,z,m,k=0;
int t[16]={0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15};
float sayi,sayi2;
int1 ksr=0,flag=0;
int1 toplama,cikarma,carpma,bolme;
#int_EXT
void EXT_isr(void){
i=input(pin_b1);
y=input(pin_b2);
z=input(pin_b3);
m=input(pin_b4);
k=i+y*2+z*4+m*8;
flag=1;
}
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillotar Config tab
// TODO: USER CODE!!
ext_int_edge(L_to_H);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
set_tris_B(0x1F);
lcd_init();
printf(lcd_putc,"\f calculator\n");
delay_ms(3000);
while(1)
switch (k){
case 10:
toplama=1;
printf(lcd_putc,"\f +\n");
delay_ms(1000);
sayi2=sayi;
sayi=0;
break;
case 11:
cikarma=1;
printf(lcd_putc,"\f -\n");
delay_ms(1000);
sayi2=sayi;
sayi=0;
break;
case 12:
carpma=1;
printf(lcd_putc,"\f * \n");
delay_ms(1000);
sayi2=sayi;
sayi=0;
break;
case 13:
bolme=1;
printf(lcd_putc,"\f / \n");
delay_ms(1000);
sayi2=sayi;
sayi=0;
break;
case 14:
ksr=1;
break;
case 15:
if(toplama==1){
sayi2=sayi2+sayi;
printf(lcd_putc,"\f%f",sayi2);
delay_ms(1500);
sayi=0;
sayi2=0;
toplama=0;
}
if(cikarma==1){
sayi2=sayi2-sayi;
printf(lcd_putc,"\f%f",sayi2);
delay_ms(1500);
sayi=0;
sayi2=0;
cikarma=0;
}
if(carpma==1){
sayi2=sayi2*sayi;
printf(lcd_putc,"\f%f",sayi2);
delay_ms(1500);
sayi=0;
sayi2=0;
carpma=0; }
if(bolme==1){
sayi2=sayi2/sayi;
printf(lcd_putc,"\f%f",sayi2);
delay_ms(1500);
sayi=0;
sayi2=0;
bolme=0;}
break;
default :if (flag==1){
if(!ksr){
sayi=(sayi*10+t[k]);
printf(lcd_putc,"\f%f",sayi);
delay_ms(1500);
flag=0;
}
if(ksr){
sayi=sayi*10+(t[k]/10);
printf(lcd_putc,"\f%f",sayi);
delay_ms(1500);
flag=0;}
}}}
sayıyı yazıyor fakat işlemler de hata yapıyor.