12f675 Giriş Çıkış Ayarlama

Başlatan samett384, 14 Nisan 2017, 00:06:26

samett384

Selam arkadaşlar.16F877a 'da yazmış olduğum programı 12f675 e de yazmak istiyorum,ancak baya bi sıkıntıyla karşılaştım.pic'in bacaklarını giriş, çıkış olarak ayarlıyamıyorum.Yardımınıza ihtiyacım var .
#include <12f675.h>


#use delay(clock=4M)


void main()
{
set_tris_a(0x3);
#define BUTON1 pin_GPIO0
#define BUTON2 pin_GPIO1
#define LED1 pin_GPIO4
#define LED2 pin_GPIO5



output_GPIO(0);
while(1)
{
if(input(BUTON1)==1)                                 
{
while(1)
{
output_high(LED1);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_low(LED1);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_high(LED1);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_low(LED1);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_high(LED1);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_low(LED1);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_high(LED2);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_low(LED2);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_high(LED2);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_low(LED2);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_high(LED2);
if(input(BUTON2)==1)
break;
delay_ms(90);
if(input(BUTON2)==1)
break;
output_low(LED2);
if(input(BUTON2)==1)
break;
}
while(1)
{
output_high(LED1);
if(input(BUTON1)==1)
break;
delay_ms(350);
if(input(BUTON1)==1)
break;
output_low(LED1);
if(input(BUTON1)==1)
break;
delay_ms(50);
if(input(BUTON1)==1)
break;
output_high(LED2);
if(input(BUTON1)==1)
break;
delay_ms(350);
if(input(BUTON1)==1)
break;
output_low(LED2);
if(input(BUTON1)==1)
break;

}
}
}



//!





   
   
    
   

agora_meyhanesi42

set_tris_a(0x3) yerine set_tris_io (0x03) şeklinde yazmam lazim
Yüksel Türk ! Senin için yükselmenin hududu yoktur...