elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Trabajando con las ramas de git (tercera parte)


  Mostrar Mensajes
Páginas: [1]
1  Informática / Electrónica / Urgente porfa en: 26 Noviembre 2009, 02:37 am
hola pues me ha gusta mucho lo que has subido
Esperaba que tal vez con la experiencia que tienes en pic c me pudieras ayudar con un problemilla que tengo
nose como comparar los puertos por ej q si el puerto a es mayor q el puerto b ponga en 1 el pin b7 o algo asi
he tratado de guardarlo en variables ej int8 variable=input_a() pero aunque compila al simularlo en proteus no hace nada ya queme el pic con el programa pero aun no pasa nada.
Estoy usando ciclos while y el pic q uso es el 16f877a
MIRA aca esta el programa, te agradeceria mucho que lo pudieras revisar me harias un gran favor... saludos

#include <16f877.h>
 #fuses XT, NOWDT, NOPROTECT, PUT, Brownout
 #use delay (clock = 4000000)
 #use fast_io(a)
 #use fast_io(b)
 #use fast_io(c)
 #use fast_io(d)

int8  a1;
int8  b1;
int8  c1;
int8  d1;
 
 // programa
 void main (void)
 
     {
 a1= input_a();
  b1= input_b();
  c1= input_c();
  d1= input_d();
    set_tris_a(0x3f);
    set_tris_b(0x3f);
    set_tris_c(0x3f);
    set_tris_d(0x3f);
while(true)
{
   
     while(a1 != b1)
     {
     
while(a1 < b1)
     {
   output_high(PIN_D7);
   output_low(PIN_D6);
   output_high(PIN_C7);
   output_low(PIN_C6);
     }
    while(a1 > b1)
     {
   output_low(PIN_D7);
   output_high(PIN_D6);
   output_low(PIN_C7);
   output_high(PIN_C6);
     }
     }
 
     do
     {
   output_high(PIN_D6);
   output_low(PIN_D7);
   output_low(PIN_C6);
   output_high(PIN_C7);
   //delay_ms(1000);
 
   
     }
      while(0);
   
       while(c1!= d1)
     {
     
while(c1 < d1)
     {
   output_high(PIN_D7);
   output_low(PIN_D6);
   output_high(PIN_C7);
   output_low(PIN_C6);
     }
     while(c1 > d1)
     {
   output_low(PIN_D7);
   output_high(PIN_D6);
   output_low(PIN_C7);
   output_high(PIN_C6);
     }
     }
   
     do
     {
   output_high(PIN_D6);
   output_low(PIN_D7);
   output_low(PIN_C6);
   output_high(PIN_C7);
   //delay_ms(1000);
 
   
   
     }
      while(0);
   }
}


     
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines