merhabalar ,elimde 8x8 dotmatris 16f628-74595-3 buton ile çoçuğum için 1. butona basınca harfleri 2. butona basılınca şekilleri 3 butona basınca sayıları gösteren devre yaptım . b portu tamamen çıkış a portu ra0-ra1 74595 kontrolü için(clock ve data lanchı da clok verdim )ra2 portun a 3,buton ra3 e 2cı buton ra4e 1.. butonu koydum . programı yazdım ama ne yapyıysam ra2 yı buton grişi olarak tanımlayamadım program aşağıdadır . devre 2 buton olarak istenilen gibi çalışıyor sayı butonu basmıyor #include "16F628.H" #FUSES XT,NOWDT,NOPROTECT,NOLVP,NOPUT,NOCPD #use delay(clock=4000000)//PIC OSİLATÖRU 4Mhz SECİLİYOR #use fast_io(b)//HIZLI GIRIŞ CIKIŞ AYARI #use fast_io(a) int i=0,f=0,x=150,y=0,Z=0,a=0,b=0,c=0,h=0;// const char harf[208]={ 255,243,237,222,192,222,222,222,//A 255,224,222,222,224,222,222,224,//B 255,225,222,254,254,254,222,225,//C 255,224,222,222,222,222,222,224,//D 255,224,254,254,240,254,254,224,//E 255,224,254,254,248,254,254,254,//F 255,225,254,254,224,238,238,224,//G 255,238,238,238,224,238,238,238,//H 255,224,251,251,251,251,251,224,//I 251,255,224,251,251,251,251,224,//İ 255,239,239,239,239,239,238,241,//J 255,238,246,250,252,250,246,238,//K 255,254,254,254,254,254,254,224,//L 255,238,228,234,238,238,238,238,//M 255,238,236,236,234,230,230,238,//N 255,241,238,238,238,238,238,241,//O 245,255,241,238,238,238,238,241,//Ö 255,240,238,238,238,240,254,254,//P 255,224,238,238,240,246,238,222,//R 255,241,238,254,241,239,238,241,//S 255,224,251,251,251,251,251,251,//T 255,238,238,238,238,238,238,241,//U 245,255,238,238,238,238,238,241,//Ü 255,238,238,238,238,238,245,251,//V 255,238,238,245,251,251,251,251,//Y 255,224,239,247,251,253,254,224,//Z }; const char sayi[80]={ 255,241,238,238,238,238,238,241,//0 255,251,249,250,251,251,251,224,//1 255,241,238,239,247,251,253,224,//2 255,241,238,239,243,239,238,241,//3 255,247,251,253,254,246,224,247,//4 255,224,254,224,239,239,238,225,//5 255,241,238,254,240,238,238,241,//6 255,192,223,239,247,251,251,251,//7 255,241,238,238,241,238,238,241,//8 255,241,238,238,241,239,239,241,//9 }; const char sekil[208]={ 24,60,90,231,231,90,60,24,//baklava 231,219,189,126,189,189,165,165,//ev 201,128,128,193,227,247,255,255,//kalp 90,189,90,231,231,90,189,90,//baklava2 128,221,235,247,235,221,128,255,//kumssati 235,247,118,129,118,247,247,235,//dron 247,235,221,190,221,235,247,255,//yamuk 243,235,171,0,171,235,235,243,//okyay 239,207,128,0,128,207,239,255,//oksağ 255,255,219,255,255,126,189,195,//gülen surat 255,255,219,255,255,195,189,126,//somurtan surat 255,190,213,227,193,227,213,190,//kartane 239,199,131,239,239,0,129,195,//gemi 251,193,222,239,247,51,129,192,//kuğ 255,255,219,255,255,195,219,195,//şaşkın surat 189,219,231,0,126,126,126,0,//tv 255,252,252,0,84,124,255,255,//anahtar 247,227,193,128,227,227,227,227,//yukarıok 247,243,1,0,1,243,247,255,//solok 227,227,227,227,128,193,227,247,//aşağıok 227,227,247,193,247,247,235,221,//cinali 0,126,66,90,90,66,126,0,//içiçekare 247,227,193,128,255,255,255,255,//üçgen 255,99,93,30,93,99,255,255,//balık 223,239,247,195,223,239,247,251,//yıldırım 193,182,182,128,136,128,193,213,//kurukafa }; void ekranset(){for(i=0;i<9;i++){output_a(1); delay_ms(1); output_a(0); delay_ms(1);}} void int ekran(a){output_a(3); delay_ms(1); output_a(0);for(i=0;i<9;i++){output_b(harf[a+i]); output_a(1); delay_ms(1); output_a(0);} } void int ekran1(a){output_a(3);if(a>72){a=0;} delay_ms(1); output_a(0);for(i=0;i<9;i++){output_b(sayi[a+i]); output_a(1); delay_ms(1); output_a(0);} } void int ekran2(a){output_a(3); delay_ms(1); output_a(0);for(i=0;i<9;i++){output_b(sekil[a+i]); output_a(1); delay_ms(1); output_a(0);} } void int anaekran(h){ if(h==8){ekran(a);} if(h==4){ekran1(a);} if(h==16){ekran2(a);} } void main() { setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DISABLED,0,1); setup_comparator(NC_NC_NC_NC); setup_vref(VREF_LOW|-2); set_tris_a(0x38);//gıriş cıkış belirleniyor set_tris_B(0x00); ekranset(); while(1){ h=input_a();a=a+8;if(a>200){a=0;} while(h>0){z=h; h=input_a(); anaekran(z);} while(h==0){h=input_a();anaekran(z);} } } |
Bildirim